Tuesday, April 13, 2010

iWork Numbers Automator Actions to import text

I love iWork, especially Numbers; good golly, does Office suck on the Mac. iWork isn't up to speed, yet; notably, Numbers is horrible at importing text and formatting it into spreadsheet cells in a sensible way. Here are some OS X services that I made with Automator that are helpful for me.

As near as I can tell, the only way for Numbers to import plaintext table data is as a CSV file. The file needs to be comma-delimited, and ending in a .csv extension. I often want to grab data from the terminal, though. The Import CSV Text To Numbers Service takes selected comma delimited text and pops open a new Numbers document with it. The Import Whitespace Text To Numbers Service does the same, with whitespace delimited text. You can install these services by extracting them from the .zip files and moving them to your ~/Library/Services directory.

Note 1: For both of these Services, a scratch file is generated. A dialog box will pop up, asking to delete the scratch file. Only click OK once the file has finished loading.
Note 2: These Services operate on blocks of text, not text files; you can open a file and select the text you want imported to Numbers, that works fine.
Pedantic note on Import Whitespace Text To Numbers: This works via the sed command
sed -E 's/^[[:space:]]+//;s/[[:space:]]+/,/g'
which actually takes all blocks of whitespace and converts them to commas. The file is then saved as a .csv, and is opened by Numbers. This means that any commas in the source text will be treated as delimiters, as well.

Import CSV Text To Numbers
Import Whitespace Text To Numbers

1 comment:

  1. Have you tried playing with google docs spreadsheets?

    As a user of many computers, i always expect to have what i need with me, and docs guarantees that, assuming an internet connection.

    similar to numbers it seems, its not full featured yet, but manages to handle most of what i want to do. plus, FREE!

    p.s. how are you alex? its been a while since i've run into you on campus. hope all is well!

    ReplyDelete

Blog Widget by LinkWithin