0
votes

I am writing a script for google sheets, and I need to know if the following is possible:

If a user does not have editing permission for a sheet, could they still run scripts which edit the sheet?

Basically, my goal is this: I have a sheet of data, and certain people need to be able to edit certain cells. However, I do not want them directly editing the spreadsheet, so I have created a GUI that allows users (which the script validates) to edit particular cells. Will the users be able to run the scripts which edit cells if they do not have permission to edit the sheet itself?

Thanks,

Jordan

2

2 Answers

2
votes

I had came across this same requirement. I did some work around.
In your case what you can do is
1. Create a hidden sheet. This will not be protected for any user, but it will hidden
2. Save the data that is entered through GUI to this hidden sheet and then call onEdit form here.
3. onEdit will move the data in hidden sheet to the visible-protected sheet. Since onEdit works under the script owners id it will be having access to the visible-protected sheet.

This way has worked for me. Please check.
Best

0
votes

That's easy to test by yourself... try this sheet with "view only " rights

No possibility to run a script ! not even running the installed onOpen trigger.

The only way to get such a workflow it to deploy a webapp that runs "as you" where users could view and edit the cells in the Ui itself and have the webapp reflect/update the spreadsheet.

Quite a lot of work (depending on the complexity of your spreadsheet) but perfectly doable.