Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread John Engelhart
On Thu, Oct 1, 2009 at 7:09 PM, Colin Howarth wrote: > Hi, > > I'd like my app ('tis progressing steadily :-) to read some simple tabular > data. The original file is from Excel, but it's not too much bother to > convert it to CSV. > > Searching the developer docs gets me > > "gestaltGraphicsVers

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread I. Savant
On Oct 2, 2009, at 4:19 PM, Alex Kac wrote: Yes! In any case, I'm sure libcsv is more powerful and correct, but the category there worked for my purposes working with several cloud services. You need only address quoted fields, line breaks within fields, respect character encodings, and

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Alex Kac
Yes! In any case, I'm sure libcsv is more powerful and correct, but the category there worked for my purposes working with several cloud services. On Oct 2, 2009, at 3:16 PM, I. Savant wrote: On Oct 2, 2009, at 4:15 PM, Alex Kac wrote: Here is something I use that has worked for me fairly

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread I. Savant
On Oct 2, 2009, at 4:15 PM, Alex Kac wrote: Here is something I use that has worked for me fairly well. I found it either on this list or somewhere on the web, so sharing back to the list. http://pastie.org/639863 This appears to be the code listing from the article I mentioned on MacRe

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread I. Savant
On Oct 2, 2009, at 4:03 PM, Colin Howarth wrote: CSV isn't *that* hard to parse, once you know about quotes and NLs inside cells. ... and encodings and line endings. Don't forget how much goodness Cocoa gives you automagically. :-) -- I.S. ___

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Alex Kac
Here is something I use that has worked for me fairly well. I found it either on this list or somewhere on the web, so sharing back to the list. http://pastie.org/639863 On Oct 2, 2009, at 3:03 PM, Colin Howarth wrote: Yes, thanks Mike (and all others). My particular table is only around

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Colin Howarth
Yes, thanks Mike (and all others). My particular table is only around 100 x 100 cells, so Drew's code is fine. Regarding the efficiency points raised in these posts, perhaps Stephen's pointer libcsv is a potential option. http://sourceforge.net/projects/ libcsv/ is a good idea. CSV isn'

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Kyle Sluder
On Fri, Oct 2, 2009 at 11:27 AM, DKJ wrote: > I've just been using NSXMLParser for the first time. Can Excel files be > saved in XML format? If so, would NSXMLParser be a possible solution here? XML isn't a format, per se. It's a structured markup language. The actual layout of the data (the sc

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread DKJ
I've just been using NSXMLParser for the first time. Can Excel files be saved in XML format? If so, would NSXMLParser be a possible solution here? dkj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or mode

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Adam R. Maxwell
On Oct 2, 2009, at 6:10 AM, I. Savant wrote: On Oct 2, 2009, at 7:42 AM, Mike Abdullah wrote: While using this code in an experimental project I found the app was routinely using 500+ MB of RAM. When measured with Instruments I realised that every time you use a character set for string

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread I. Savant
On Oct 2, 2009, at 7:42 AM, Mike Abdullah wrote: While using this code in an experimental project I found the app was routinely using 500+ MB of RAM. When measured with Instruments I realised that every time you use a character set for string scanning, Foundation internally copies it, presu

Re: Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Stephen Hoffman
Before I go through the 550,000 hits (some of them quite old) dare I ask if there's one Right Way (TM) to parse this sort of data? I'm not aware of one Right Way (™) here. If you're stuck due to somebody else's decision to use CSV, libcsv is a potential option. http://sourceforge.net/proje

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Mike Abdullah
While using this code in an experimental project I found the app was routinely using 500+ MB of RAM. When measured with Instruments I realised that every time you use a character set for string scanning, Foundation internally copies it, presumably to ensure it has an immutable object to wor

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread I. Savant
On Oct 2, 2009, at 6:34 AM, Mike Abdullah wrote: inefficient due to its use of NSMutableCharacterSet. Could you expand on this? Once created and manipulated, what makes it slow for string scanning compared to NSCharacterSet? I hadn't heard this. -- I.S. ___

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Mike Abdullah
On 2 Oct 2009, at 02:37, Colin Howarth wrote: Thanks everyone! The idiot savant was first to point out the http://macresearch.org/cocoa-scientists-part-xxvi-parsing-csv-data link. And that one refers also to the cocoadev site. As a warning, that particular bit of code is pretty inefficient

Re: reading (parsing) CSV (or Excel) data

2009-10-01 Thread Colin Howarth
Thanks everyone! The idiot savant was first to point out the http://macresearch.org/cocoa-scientists-part-xxvi-parsing-csv-data link. And that one refers also to the cocoadev site. It seems everyone expects there to be a standard Cocoa solution, is surprised that there isn't, and develops t

Re: reading (parsing) CSV (or Excel) data

2009-10-01 Thread Greg Guerin
http://www.cocoadev.com/index.pl?ReadWriteCSVAndTSV That site has enough good stuff, often with links to other stuff, that it's worth using a site:cocoadev.com qualifier in your googling. Or just start there. -- GG ___ Cocoa-dev mailing lis

Re: reading (parsing) CSV (or Excel) data

2009-10-01 Thread Rick Genter
On Oct 1, 2009, at 5:22 PM, Jens Alfke wrote: On Oct 1, 2009, at 4:09 PM, Colin Howarth wrote: Before I go through the 550,000 hits (some of them quite old) dare I ask if there's one Right Way (TM) to parse this sort of data? If the data's not too huge, you can read the file into an NSStr

Re: reading (parsing) CSV (or Excel) data

2009-10-01 Thread BareFeet
On 02/10/2009, at 10:22 AM, Jens Alfke wrote: If the data's not too huge, you can read the file into an NSString, break that into lines (there are some NSString methods for this, but I don't remember their names), and then on each line call [line componentsSeparatedByString: @","] to get th

Re: reading (parsing) CSV (or Excel) data

2009-10-01 Thread Jens Alfke
On Oct 1, 2009, at 4:09 PM, Colin Howarth wrote: Before I go through the 550,000 hits (some of them quite old) dare I ask if there's one Right Way (TM) to parse this sort of data? If the data's not too huge, you can read the file into an NSString, break that into lines (there are some NSSt

reading (parsing) CSV (or Excel) data

2009-10-01 Thread Colin Howarth
Hi, I'd like my app ('tis progressing steadily :-) to read some simple tabular data. The original file is from Excel, but it's not too much bother to convert it to CSV. Searching the developer docs gets me "gestaltGraphicsVersion" which is not good, but googling "cocoa csv" works very wel