Categories
Blog News

Importing a comma-separated csv file into Numbers Tool

I created this to scratch an itch of mine when reading a csv file into Numbers that contained commas. It turned out that Numbers puts each line into a single cell. It ignores the commas. And there’s no way to specify that the delimiter needs to be a comma, not a semi-colon.

Here’s a small tool made using a small python script and Platypus that will launch as a ‘droplet’ and will allow you to drop a csv file on it that has COMMA (meaning this , ) separated values.

It will accept any csv file and convert from commas (,) to semi-colons (;) and save the result out again as “filename2.csv” – Numbers should be able to open it correctly then. Your original csv file is only read.

Please note that commas inside double quotes are preserved and not converted.

It works on my smallish csv files, but please note :

! WARNING ! THERE ARE NO GUARANTEES THAT THIS WILL WORK FOR YOU – YMMV ! WARNING !

Please note there is NO feedback if something goes wrong.

It works on my 2 macs (using OS X Mavericks), so I figured I would throw it out in the wild for those people who also might need it.

You can download the (non-signed) app here : Com2DotCom.app – you’ll need to open it using RIGHT-CLICKING on the App the first time.

Feedback, comments, bug reports, etc are very welcome. If possible, I’ll try to respond and help you out.

(Visited 11,696 times, 1 visits today)

35 replies on “Importing a comma-separated csv file into Numbers Tool”

Hello Tina,

As far I can find, there are no options in Numbers to export to CSV files with a comma instead of a dot-comma as a seperator.

If the data is not too complicated (meaning it contains complex uTF-8 characters), I could probably write you a very quick and dirty python script that will do the reverse : take all the ; and replace them with just commas. Just the reverse of what the script now does, in fact.

Do you have any experience with python scripts ? If not I’ll see if I can create another drop thingy, but it’ll take some more time and that depends a bit on when I have some free time to work on it…

The best thing would be if you could post or send me a few sample lines of what you want to convert though… (nothing secret, but similar to what you want converted). That way I can use that as a test.

Alex

Thanks you for this app.
It works with smaller files. No I want to try it with a file of 900 ‘lines’ but I don’t get a result. Is there a max?

It should work, there is no max lines programmed into it. But if your file is not correctly formatted, it fails silently. Let me know if you need some more help.

Hi Rob,

the line
global header
and the comment line preceding it, appear unneeded. And a typo: garanties -> guarantees.

It would be nice to state that comma’s encapsulated within the field delimiters (double quotes in my case) are preserved. So in these case the comma’s are not treated as field separators, but as actual cell content!

So the lines
"a, b, and c","d, e","f"
"klm","xyz","Rob's test"

results in
a, b, and c;d, e;f
klm;xyz;Rob's test

giving a 2×3 table.

No worries Roger ! Though I was a bit confused at first. With the global header are you talking about the actual code I wrote ? That was a quick script… I’m sure there are other mistakes in there.

As for the commas that are preserved inside the field delimiters: I’ll add it to the description.

it worked so easily..

It just needs to rename the file or create a copy so that you know it has actually done something!

Actually, it should rename the filename to filename2 – the program only *reads* the original file, never writes to it.

Changing Mac OSX System Preferences > Language & Region > Advanced > Number Separators-Decimal and Currency-Decimal from a comma to a dot resolves the issue for me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.