0

I am working on a JXA script that will be used to copy tables from an existing Numbers sheet, and then paste them into a newly created sheet (in the same document) before making some modifications to individual cell values. I have most of what I need working, but have been unable to figure out how to change the active sheet from the source sheet to the destination sheet (or any sheet).

I have tried the following;

Numbers.documents[0].sheets.byName({name: currentSheet}).activate

It seems to execute (there are no errors), but nothing happens in Numbers. The active sheet does not change. I have the script working in AppleScript using

set active sheet to sheet currentSheet

Any help is appreciated.

1 Answers1

0

I hope this help.

var numbersApp = Application("Numbers");
var docNumbers = numbersApp.documents[0]

// First sheet
docNumbers.activeSheet.set(docNumbers.sheets[0])

// Using sheet name
docNumbers.activeSheet.set(docNumbers.sheets["sheetName"])
wchongo
  • 31
  • 4