House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

inserting a new row at the top of CSV file

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Akos Fortagh
07/09/2012 03:51 PM

unusual request I know, I have a CSV file with lots of rows but it has no column headings.  Is there a way of inserting a row at the top of the file (1st row) with the heading names? any help would be appreciated.  thanks

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Akos Fortagh
07/09/2012 03:51 PM

Unusual request I know, I have a CSV file with lots of rows but it has no headings, is there a way of inserting a new row at the top of the CSV file with some heading names? Any help would be greatly appreciated.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
John M Bliss
07/09/2012 03:57 PM

<cffile action="read" file="myfile.csv" variable="myvariable"> <cfset myvariable = "header1,header2,header3" & chr(13) & chr(10) & myvariable> <cffile action="write" file="myfile.csv" output="#myvariable#"> On Tue, Jul 10, 2012 at 1:57 PM, Akos Fortagh <akos.fortagh@yahoo.com>wrote: ----- Excess quoted text cut - see Original Post for more -----

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Akos Fortagh
07/10/2012 03:50 AM

thanks very much, it worked....


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 21, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference