Passionate Development From Journeyman to Master

Reading and processing CSV file

Read the file using cffile tag and put it into a variable: [code=”cf”] <cffile action=”read” file=”something.csv” variable=”csvfile”> [/code]

Treat the variable as a list using chr(10) and chr(13) as delimiters (they are newlines), and then loop the lines. At this point, we might want to loop the line using comma as delimiters or we can extract value from the list using listGetAt function. [code=”cf”] <cfloop index=”index” list=”#csvfile#” delimiters=”#chr(10)##chr(13)#”> <cfset thisEmail = listgetAt(‘#index#’,1, ‘,’)> … more processing … </cfloop> [/code]

coldfusion