MacMost Q&A Forum • View All Forum QuestionsAsk a Question

How Do I Use Javascript To Get Values From a Numbers Spreadsheet?

Gary,

I am trying to use javascript in script editor to get the value of a range of cells from a Numbers spreadsheet. AppleScript does it with:

tell application “Numbers”
open alias “Macintosh HD:Users:danaeugene:Documents:Numbers Files:AppleScript PRACTICE2.numbers”
tell the first table of the active sheet of document 1
set theNames to value of cells in range “A1:C1”
end tell
end tell
result: {“AA1”, “BB1”, “CC1”}

I can get javascript to open the spreadsheet using:

Numbers = Application (“Numbers”);
Numbers.open(“/Users/danaeugene/Documents/Numbers Files/AppleScript PRACTICE2.numbers”);

However I have been unable to get values from cells or a range of cells. I know it must be some simple syntax error but I am stumped. I have studied the dictionary. And searched every resource that I can think of and have not come up with an example using Javascript to get cell values from a Numbers spreadsheet. Do you have any suggestions?

Thanks,
Dana Stevens

—–
Dana Stevens

Comments: 3 Responses to “How Do I Use Javascript To Get Values From a Numbers Spreadsheet?”

    8 months ago

    I’ve got such an example from an episode from about 2 years ago. Maybe this will help:

    Populating a Keynote Presentation From a Numbers Spreadsheet Using JavaScript.

    Dana Stevens
    8 months ago

    Exactly what I needed. I should have searched MacMost more thoroughly, sorry. Thanks for being there for us.

    Dana Stevens
    8 months ago

    Gary,
    Studying your script and with some reference to the dictionary I was able to accomplish the task. I’m sure it’s not the most elegant javascript but it works. Now I’m able to experiment and discover. Thanks again for your help.
    Take care,
    Dana

Comments Closed.