0

I want to sort a Numbers table using Javascript for Automation, the code like

table.sort(table.columns["P"], {direction: "descending"})

But the Script Editor told me: Parameter is missing. (-1701)

the sort method

Here is the code I wrote:

 var Numbers = Application("Numbers")
 var path = Path("/Volumes/sfufoet/test.numbers")

 var doc = Numbers.open(path)

 var sheet = doc.sheets[1]
 var table = sheet.tables[1]

 table.sort(table.columns["P"], {direction: "descending"})

Thanks!

sfufoet
  • 1,091
  • 1
  • 6
  • 4

1 Answers1

1

I found it!

the right code is:

table.sort({by:table.columns["P"], direction: "descending"})
sfufoet
  • 1,091
  • 1
  • 6
  • 4