> There's a really nice set of utility classes available at
> http://www.ostermiller.org/utils/CSV.html that I've used with great success
> for parsing CSV files. It takes care of all the nastiness with quotes in
> Excel CSV files. It also has classes for handling "normal" CSV files.
> Little more work than dropping in a UDF, but it's blazing fast.
You guys are all using the word "normal" wrong here.. Excel produces
perfectly normal CSV files (amazingly)... Unfortunately, "normal" csv
files can be rather complex.
Perl has some modules similar to the java classes above that handle true
CSV parsing, and if you expect to ever get a CSV generated by Excel,
Access, or any variety of other applications, you should consider using
such classes.
You could probably do it like this:
<CFFILE ... VARIABLE="csvdata">
<cfscript>
csvinput = CreateObject("java", "java.io.StringReader");
csvinput.init(csvdata);
csvparse = CreateObject("java","com.Ostermiller.util.CSVParser");
results = csvparse.parse(csvinput)
// results = 2 dimensional array of values
</cfscript>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

