Re: Importing/parsing CSV files
Re: Importing/parsing CSV files
- Subject: Re: Importing/parsing CSV files
- From: T&B <email@hidden>
- Date: Wed, 13 Sep 2006 11:03:40 +1000
Hi Kai,
Late to the party, Tom
At least you could make it. There's still plenty of cake ;-)
but I've had a brief look at one or two tid- based ways to do this.
Did you write this a while back, or garner it from somewhere else?
The following handler assumes that the csv data is plain text (formatted as output from Excel):
on |csv as list| from t
set d to text item delimiters
set q to ASCII character 0
set p to ASCII character 1
set c to ASCII character 2
set text item delimiters to "\"\""
set t to t's text items
etc
When tested here on a 1000-row csv file, these handlers generally execute up to 40 times faster than the character-by-character method.
Fantastic :-) Thanks for taking the time to post.
YMMV, of course. But the comparison might be useful...
My preliminary tests with my 30 column x 350 ish row test CSV file gives:
Time Method/script
5s Tom's character by character (posted earlier)
3s Tom's delimiter parsing (linefeed, comma, then quotes)
1s Kai's delimiter parsing and temp ASCII 0, 1, 2 substitution
I'll have to test it further to see what's responsible for the speed improvement.
Thanks,
Tom
T&B
_______________________________________________
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