I did the same thing not to long ago, importing emails from an ACT exported list. I ended up using reading the uploaded file via an ODBC Text DSN. This lets the ODBC driver handle any corrupted data, and turns the csv into a query automagically. All I did was manually create a ODBC Text DSN to get the schema.ini format, and proceeded to write the below function to handle creating text dsns on the fly.
<cffunction name="cvsToQuery" returntype="query"> <cfargument name="filename" type="string"> <cfset var schemaFile = "E:\emailman\emailUpload\schema.ini"> <!--- Make sure dsn name hasn't been created already ---> <cfif len(trim(getProfileString(schemaFile, arguments.filename, "ColNameHeader"))) EQ 0> <cfset rs = setProfileString(schemaFile, arguments.filename, "ColNameHeader", "False")> <cfset rs = setProfileString(schemaFile, arguments.filename, "Format", "CSVDelimited")> <cfset rs = setProfileString(schemaFile, arguments.filename, "MaxScanRows", "0")> <cfset rs = setProfileString(schemaFile, arguments.filename, "CharacterSet", "OEM")> <cfset rs = setProfileString(schemaFile, arguments.filename, "Col1", "CUSTNAME Char Width 255")> <cfset rs = setProfileString(schemaFile, arguments.filename, "Col2", "CUSTREP Char Width 255")> <cfset rs = setProfileString(schemaFile, arguments.filename, "Col3", "CUSTEMAIL Char Width 255")> </cfif> <cfquery datasource="textsource" name="textqry"> SELECT * FROM [#arguments.filename#] </cfquery> <cfreturn textqry> </cffunction> -- jon mailto:[EMAIL PROTECTED] Tuesday, January 7, 2003, 5:27:11 PM, you wrote: PK> I have a CSV file that I want to read into variable (see below). Before PK> doing so I think I should test the construction of the file to ensure that PK> its valid otherwise I think there is a risk of the process falling over if PK> it encounters a badly constructed file somewhere a long the way. How can I PK> test that a file is a validly constructed CSV file. It will contain e-mail PK> addresses exported from ACT. PK> TIA!!! PK> <cffile action="READ" file="loop.txt" variable="LoopVariableName"> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4