Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

sample script for numbers

Do you have a sample script for numbers for extracting values from a CSV file in Numbers and putting them in a new column?

MacBook Pro (Retina, Mid 2012), Mac OS X (10.7.4), 8g ram Vectorworks Sketchup Rhino

Posted on Aug 3, 2015 3:26 PM

Reply
3 replies

Aug 3, 2015 3:35 PM in response to William Huchting

I suggest opening the CSV file in your favorite text editor (like TextEdit), then replace all the commas with Tabs,

- then save to a NEW file (just until you are certain of the procedure), then open the new CSV file in Numbers OR

- select all in the text document, copy, select any cell in a blank table (I usually select A1) then paste

Aug 4, 2015 7:49 AM in response to William Huchting

William Huchting wrote:


Do you have a sample script for numbers for extracting values from a CSV file in Numbers and putting them in a new column?


Hi William,


You can try these Automator Services. They contain AppleScript that you can inspect by opening them in Automator. After the double-click installation you can navigate to the services to have a look at them as follows: in Finder hold down the option key and Go > Library > Services.


The key csvToList() "handler" (subroutine) was posted by Nigel Garvey at MacScripter.net. It handles the various csv formats encountered "in the wild" better than anything I have ever seen, about as well as the csv parser built into Excel, and that's saying a lot.


To use the Services you don't need to worry about going to the Library. Just a few clicks and a menu pick and a paste and you're done, as described below.


A. If your semicolon-separated values are still in a file ...


Install this CSV to Tabs on Clipboard Automator Service (Dropbox download) by double-clicking the downloaded .workflow package and, if necessary, "Open Anyway" in System Preferences > Security & Privacy.

Thereafter to use with Numbers 3 or Numbers 2, simply:


  1. Locate and select the file in Finder.
  2. Right-click it and choose 'CSV to Tabs on Clipboard' from the Services contextual menu.
  3. Answer the prompts about the separator (in your case choose the semicolon).
  4. Click once in a cell in an existing table in Numbers.
  5. Command-v to paste.


That's it!

B. If your semicolon-separated values are already in a column in Numbers 3 ...Install this Text to Columns Automator Service (Dropbox download) by doubleclicking the downloaded .workflow package and, if necessary, "Open Anyway" in System Preferences > Security & Privacy.

Thereafter to use with Numbers 3, simply:

  1. Select the cells in the column where the values are located that you need to split across columns.
  2. Choose 'Text to Columns' from your Numbers > Services menu.
  3. Answer the prompts to choose a delimiter (separator).
  4. Click once in the top-left destination cell (I usually choose the top of the column immediately to the right of the selection).
  5. Command-v to paste.


That's it. This last one is similar to the 'Text to Columns' wizard in Excel.


SG

sample script for numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.