Google-sheets – Possible to perform an “undo” via app script

google sheetsgoogle-apps-script

I'm trying to cause a 3rd party function (CRYPTOFINANCE()) to update whenever I manually trigger an update. Currently it updates any time I clear the cel contents and hit Undo. So my thinking is to simply create a script that selects the cells I want to update, clears them, and hits undo.

Unfortunately I can't find any way to execute an undo via script. Mostly I find references to it not even existing as a function, however I found reference to model.undo() which sounds like what I need. I just can't figure out how to make it work.

My other thought was maybe there is a way to just select the Undo option from the Edit menu via script, but I have a feeling that's not possible either.

Can anyone suggest a way to Undo via script that doesn't involve using a secondary sheet to store the "undo" data?

Best Answer

Google Apps Script hasn't the undo / redo commands.

NOTE: The Real Time API is not part of Google Apps Script and it's not included in the advanced services.

The alternative is to make the script to keep records of the changes made and if necessary use them to "undo" or "redo" the action.