I would like to read in a CSV file in as a 2D array and then return it back to a CSV file. Let's say that this is my CSV file. It is an excel file and the | implies the adjacent cell:
family | type
Doctor | Pediatrics
Engineer | Chemical
From what I understand, there are no arrays on applescript, just lists and records. If it would be better to do this with a XLSX file, please let me know.
Nigel's CSV-to-list converter is the best I have seen ...
http://macscripter.net/viewtopic.php?pid=125444#p125444
For your example, use these settings:
set csvText to "family | type
Doctor | Pediatrics
Engineer | Chemical"
csvToList(csvText, {separator:"|"}, {trimming:true})
v2
set csvText to read "/Users/user1385816/Desktop/yourfile.csv"
csvToList(csvText, {}, {trimming:true})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With