<cffile action="read" file="#ExpandPath('csv.csv')#" variable="thiscsv"> <cffile action="write" file="#ExpandPath('csv.htm')#" output="<table>" addnewline="true">
<cfloop list="#thiscsv#" index="thisline" delimiters="#Chr(10)#"> <cffile action="append" file="#ExpandPath('csv.htm')#" output="<tr>" addnewline="true"> <cfloop list="#thisline#" index="thiscell"> <cffile action="append" file="#ExpandPath('csv.htm')#" output="<td>#thiscell#</td>" addnewline="true"> </cfloop> <cffile action="append" file="#ExpandPath('csv.htm')#" output="</tr>" addnewline="true"> </cfloop> On Thu, Oct 1, 2009 at 2:24 PM, vidya yegnaraman <viduka...@gmail.com>wrote: > > >Probably 10 ways to do this. Here's one: > > > > 1. read in the csv file with cffile: > > http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_f_07.html#3545217 > > 2. use this to make it into a query: http://cflib.org/udf/CSVToQuery > > 3. use this to dump the query as a table: > > http://cflib.org/udf/queryToTableDump > > > >On Wed, Sep 30, 2009 at 8:00 AM, vidya yegnaraman <viduka...@gmail.com > >wrote: > > > >>Hi, > Thanks for the above links. > But, I don't want to use the cfsavecontent,since there is huge amount of > data and I run out of memory. What am trying to do now is do a cffile read > of the csv file, loop through the rows, open a cffile write to create the > file and then use a cffile append. But am facing some issues when I read the > file and write the data as a html. > I am using the following for looping and delimiters. Please suggest me what > I can use as a delimiter since there are commas in the data. > <cfloop index="i" list="#csvfile#" delimiters="#chr(10)##chr(13)#"> > When I write the list it doesn't show the data properly. > It would be great if you have a code sample where in it reads a csv file, > loops thru the records and write a html file. There are 5 columns in the csv > file. > > Thanks > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326824 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4