Sample code for reading a CSV file

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Feb 17 15:08:33 EST 2011


Paul,

A lot of code has been posted already, which might make mine superfluous, but if you want something simple you might have a look here http://qery.us/o3 . This script doesn't work if the items in your CSV file contain linefeeds or returns (but could easily be modified).

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

New: Download the Installer Maker Plugin 1.6 for LiveCode here http://qery.us/ce

On 17 feb 2011, at 19:16, Paul Dupuis wrote:

> So I am tired of reinventing the proverbial wheel over and over again.
> 
> I have a new project that I want to read a CSV file for. Obviously reading the file is easy. And is it was tab separated instead of comma, parsing out the rows and columns is easy as well. However, with comma seperated data where some columns contain string with commas in then that are encapsulated in quotes, just plowing through the itemDelimiter and lineDelimter doesn't work.
> 
> So before I bother to write code to handle encapsulated CSV data, I thought I'd ask if anyone on the use-list has existing code to handle CSV's that they'd be willing to share.
> 
> -- 
> Paul Dupuis
> Cofounder
> Researchware, Inc.
> http://www.researchware.com/





More information about the use-livecode mailing list