• 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: Importing/parsing CSV files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Importing/parsing CSV files


  • Subject: Re: Importing/parsing CSV files
  • From: Malcolm Fitzgerald <email@hidden>
  • Date: Sat, 9 Sep 2006 06:12:31 +1000

Hi Mark,

I think Doug's advice to generate a parser for each data source is sage.

I'm feeling pernickity today, so I'll take up your response.

I said to Tom: "If you are going to go ahead there are some givens, aren't there?" Then followed up with some things (which he probably already knew) aimed at helping him to consider the problem he presented.


each row must have a delimiter

Not if there's only one value in that row.

A row has to be defined even when it is empty. No delimiter: no row.  

each row must have the same number of columns

Nope.  It's a spreadsheet format.  Different rows can have different numbers of cells.

It may not have them in fact, but conceptually you are handling an array which has x rows of y cols. This understanding can help to solve the problem. If the machine outputting the data drops empty cells then that is making the job of reconstruction harder.


 If the number of columns is less than expected then the next row must
be considered.

Nope.  Newline outside of quotation marks terminates the row always.

Yes, OK. But I didn't say anything about newline outside of quotation marks. You did. In a few lines you'll use the example of a newline within quotation marks yourself. Treat this as a possible example of a newline within quotation marks and we'll be working together.


In the example sent to us several rows had some sort of new line marker in the street addresses that caused a single record to run over several rows. So a single row is not necessarily a single record. The number of columns present in a row could indicate this.

The existence of ," or ", in a row demands a corresponding closing quote

...which may be on the next line because of an embedded newline.

My point exactly. We are having to work with a format which allows a record to run over several rows. So when there is no corresponding closing quote on a line we have definitely got a multi-row record. Keep looking for the closing quote!


We'll that's about it for this nit-picker.

malcolm


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Importing/parsing CSV files (From: T&B <email@hidden>)
 >Re: Importing/parsing CSV files (From: "Mark J. Reed" <email@hidden>)
 >Re: Importing/parsing CSV files (From: T&B <email@hidden>)
 >Re: Importing/parsing CSV files (From: Malcolm Fitzgerald <email@hidden>)
 >Re: Importing/parsing CSV files (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: How to compile script in OSX
  • Next by Date: Re: How to compile script in OSX
  • Previous by thread: Re: Importing/parsing CSV files
  • Next by thread: Re: Importing/parsing CSV files
  • Index(es):
    • Date
    • Thread