Setting a cell in Numbers with AppleScript is broken


#1

I have an AppleScript that’s been working for several years that I use to populate a Numbers spreadsheet. It’s suddenly stopped working and I can’t figure out why. The line in question that fails is

set row newSalesRow's cell cellColumn's value to newValue

If I insert numbers for newSalesRow, cellColumn, and newValue it still crashes at that line. I tried

set cell cellColumn of row newSalesRow to newValue

but it also fails. The AppleScript error code is

“-1708: The script doesn’t understand the message. The event was not handled.”.


#2

Without a copy of your sheet it’s hard to experiment, but this kind of direct referencing seems to be working here (Mojave)

tell application "Numbers"
    tell front document
        tell front sheet
            tell front table
                set value of cell "C3" to "Some string"
                set value of cell "D3" to 42
                
            end tell
        end tell
    end tell
end tell



#3

Thanks for replying. My code looks exactly like that. I tried a number of different approaches and simplifications but got nowhere. I then restarted Numbers and the problem disappeared. Very frustrating.