Reputation: 1
I have the following spreadsheet:
-Template (protected)
-Current working sheet
-older sheet (protected)
-even older sheet (protected)
This spreadsheet is shared with a few users, and they have write permission in the "current working sheet". Once it is considered completed, I created a button in the "current working sheet" to which I assigned a script. When ran as owner, the script:
It all works fine wen ran by owner, however when the button that triggers the script is pressed by one of the users whom I shared the document with, then step (2) fails, meaning the sheet can't be protected. I suspect this is a permissions issue but I am a complete newbie in google scripting, so I am asking for some help here. Is there any way to make sure that no matter who presses the button, the assigned script is ran as owner?
thank you
Upvotes: 0
Views: 887
Reputation: 1512
You cannot have a button which the user at the keyboard clicks invoke a script which runs as the owner. See the doc about authorization here. That said, what you can do is have the button set a value or update a record which a script on a time based trigger checks. A flow like this would work well:
I am done!
buttonThings for scripts to do
which indicates that as of now, the working sheet should be archivedThings for scripts to do
and updates sheets and permissions as described aboveUpvotes: 1