Read the contents of the file into a variable. Then use something like this.
<!--- Loop over the number of lines in the file, using a return as a delimiter ---> <cfloop from="1" to="#listLen(csvfile, chr(10))#" index="i"> <!--- Grab a single line out of the variable ---> <cfset line = listGetAt(cvsfile,i,chr(10))> <!--- Insert the line into the database ---> <cfquery datasource="myDB"> INSERT INTO myTable (column1, column2, column3) VALUES ('#listGetAt(cvsfile,1)#','#listGetAt(cvsfile,2)#','#listGetAt(cvsfile,3)#') </cfquery> </cfloop> You will probably want to add more code for error protection/correction. That's how I would do it, though. :) Good luck! EC -----Original Message----- From: Jason Larson [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 21, 2002 11:14 AM To: CF-Talk Subject: Looping through a CSV File I have a CSV File that I am pushing up using cffile. I want to loop through the csv file and insert the content into a database, and I am not sure how to do this. Any help our guidance would help? Thanks Jason ______________________________________________________________________ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists