How to parse CSV
How to parse CSV
- Subject: How to parse CSV
- From: Benedikt Quirmbach <email@hidden>
- Date: Mon, 21 Jan 2008 12:20:19 +0100
Hi,
I'm looking for tutorials or other infos on how to parse a csv file
into a list of lists in AppleScript.
I wrote my own handler but there are some problems that I can't solve.
This is the scenario:
I get csv files from customers.
The file can be in various european languages (usually german)
These files usually come from windows systems
They contain up to 25000 data sets (lines)
The handler I wrote takes the whole file and reads it with delimiter
return
Then it takes every item of the resulting list and deletes every
white space at the beginning and the end (this is because depending
on the encoding of the file there might be a line feed left)
Then it cuts all list items into lists and deletes eventually
occuring '"' in front and at the end of every data entry.
All data will be written into a new list.
This handler has three flaws:
Most important: I have to convert the csv file to Mac Roman encoding
manually.
It is very time consuming and it needs a lot of memory.
What I need:
1a. A way to analyse the actual encoding (because not all csv files
come from windows...)
1b. A way to convert the encoding of the file with AppleScript
(characters and new line)
2. A way to speed up the program.
3. A way to use less memory (but this is not so important).
I would be very glad if someone could give me a tutorial, other infos
or maybe a readymade handler.
Benedikt
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden