• 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: 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


  • Follow-Ups:
    • Re: Importing/parsing CSV files
      • From: T&B <email@hidden>
    • Re: Importing/parsing CSV files
      • From: kai <email@hidden>
    • Re: Importing/parsing CSV files
      • From: Doug McNutt <email@hidden>
References: 
 >Re: Importing/parsing CSV files (From: T&B <email@hidden>)
 >Re: Importing/parsing CSV files (From: kai <email@hidden>)

  • Prev by Date: Re: Importing/parsing CSV files
  • Next by Date: Re: Importing/parsing CSV files
  • Previous by thread: Re: Importing/parsing CSV files
  • Next by thread: Re: Importing/parsing CSV files
  • Index(es):
    • Date
    • Thread