• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: reading (parsing) CSV (or Excel) data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: reading (parsing) CSV (or Excel) data
  • From: John Engelhart <email@hidden>
  • Date: Fri, 2 Oct 2009 14:30:11 -0400

On Thu, Oct 1, 2009 at 7:09 PM, Colin Howarth <email@hidden> 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
>
> "gestaltGraphicsVersion"
>
> which is not good, but googling "cocoa csv" works very well. The first
> couple of thousand hits seem relevant :-)
>
> 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?
>

One possible solution I haven't seen mentioned yet is to use RegexKitLite (
http://downloads.sourceforge.net/regexkit/RegexKitLite-3.1.tar.bz2).  The
documentation has an example that parses CSV strings (
http://regexkit.sourceforge.net/RegexKitLite/index.html#RegexKitLiteCookbook_PatternMatchingRecipes_TextFiles_ParsingCSVData).
 When I did some simple benchmarks parsing CSV files using the
documentations example code, it significantly outperformed other solutions
that I tried.  One of those was the MacResearch example that's already been
mentioned, but this was some time ago, so things may have changed and your
milage may vary. It only takes ~17 lines of code to parse CSV strings in to
a NSArray (lines) of NSArrays ('columns') using RegexKitLite, so making
modifications to fit your particular needs is very doable.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >reading (parsing) CSV (or Excel) data (From: Colin Howarth <email@hidden>)

  • Prev by Date: Re: View shifted up on iPhone simulator
  • Next by Date: Re: CoreData async fetch request
  • Previous by thread: Re: reading (parsing) CSV (or Excel) data
  • Next by thread: Re: reading (parsing) CSV (or Excel) data
  • Index(es):
    • Date
    • Thread