Re: Importing/parsing CSV files
Re: Importing/parsing CSV files
- Subject: Re: Importing/parsing CSV files
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 7 Sep 2006 10:46:44 -0400
On 9/7/06,
Doug McNutt <
email@hidden> wrote:
Does anyone have an authoritative reference to the "official" CSV format? An RFC, for instance? The banks are really into CSV. Do they publish a standard?
No, there's no official standard. But the de facto standard is well understood. Quotation marks enclosing a field are not literal, but are there to allow the field to contain commas or newlines internally. If a field value includes a literal quotation mark, that is usually indicated by doubling the quotation mark, though I have seen apps that use a backslash.
For a one-time job, which this seems to be, a look at the actual format in use will probably get a quicker result. A couple of judicious replace statements in a text editor can remove the strange things that occur before processing with regular expressions, be it perl or satimage.
It depends - I've tried that, but frequently end up needing to go back to the source app, modify some things, regenerate the data, re-modify the data, then rerun the script. Better to just make a script that will accept the data without massaging in the first place.
In the sample results the list items are enclosed in quote marks as they would be in AppleScript source code to indicate that the items are type TEXT in the list of constant items. I'm a bit confused about just what an automated procedure should place in the list as it would occur in memory. If the list is created, as a file is read, by successively adding items each of which is TEXT there would be no quotes or commas involved unless they were intended to be part of an individual TEXT item.
Each comma-separated value is a different column in a row relating to a single item. I would expect the AS interface to return a list for each row.
--
Mark J. Reed <
email@hidden>
_______________________________________________
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