pythoniworksourceforge-appscript

How to set value of current Numbers cell using Py-Appscript


This seems like a straightforward operation but I am stumped.

How do you set value of current Numbers cell using Py-Appscript?


Solution

  • Pretty tediously, but working:

    >>> from appscript import *
    >>> app('Numbers').documents.first.sheets.first.tables.first.selection_range.cells.first.value.set(to=42)
    

    That's assuming a simple document. More generally, you can select items by name:

    >>> app('Numbers').documents['MyDocument.numbers'].sheets['MySheet'].tables['MyTable'].selection_range.cells.first.value.set(to='abc')