Eamonn
Eamonn

Reputation: 617

How to stop a cell being edited in Google App Script

If a user is in edit mode in a cell in a Google Spreadsheet, that is, the cursor is currently blinking in the cell, then I try to insert a value in that cell via an "add on" (where the user is explicitly stating they want to add a value to the cell being edited), how can I programmatically fire an event to the spreadsheet to tell it to stop editing values so that the value inserts properly?

At present, when I try to set a value while the user is editing that cell, the value passed from the add on isn't recorded in the cell, which is quite reasonable. But, the ability to "commit" changes to that cell, stop the editing, then add my value would be really useful.

Upvotes: 3

Views: 1575

Answers (1)

Zig Mandel
Zig Mandel

Reputation: 19835

You cant send a message to stop cell editing. However, try using range protection. Set the cell protected thus the user wont be able to commit her change. The ui might not reflect this until the user commits (havent tried it). You might have an issue as to when to remove the protection thou.

Upvotes: 1

Related Questions