Home > database >  Scripts are not executing for users with reader permission
Scripts are not executing for users with reader permission

Time:11-15

I have added an image on my grid, and assign script to it. But script executes only when I click on image, and when another user(with reader permission) clicks on image nothing happens. The same situation is with onOpen() trigger - nothing happens when user whith reader permission opens the grid. I understand that editor permission will fix it, but I don't need the user to be able to edit the table, I only need that user be able click buttons(image)/get alive triggers/menus that i create, but not edit anything manually. How can i do this(may be i should give some extended reader permission, or to turn on something in GAS project)?

CodePudding user response:

When users execute a script for the first time, they will get an allow permissions prompt, so they can authorize the script to make changes on their behalf.

However, if the user has viewing permissions over the sheet or file, they cannot authorize the script to run or make changes on their behalf since they cannot make changes to the file. (I found a similar question, with the difference that the sheet was embedded in a website that has some information about why it does work here).

And it's documented in the Apps Script documentation here:

An installable open trigger runs when a user opens a spreadsheet, document, or form that they have permission to edit.

You can also request a feature request to Google asking for an option to allow users with "viewing permissions" to run scripts here.

CodePudding user response:

In this case I think you may give editor's permissions but protect the sheet/range so only you can edit them with this option -->

https://support.google.com/docs/answer/1218656?hl=en&co=GENIE.Platform=Desktop#zippy=,protect-a-range-or-sheet

Let me know if this worked!


Option 2:

Adding to those protected ranges you can too create a Library with your functions in another spreadsheet (or in Google App Script independently) -> read about it here

You can now set buttons/menus associated with those original functions, but I think that this can give you an altenative For example:

function function1_toOrigin() {
 LibraryName.function1()
}
function function2_toOrigin() {
 LibraryName.function2()
}

Yes, they'll be able to access to these linking functions but nothing more, I think they won't be that unreliable??

IMPORTANT: If there are modifications to the script you should deploy them again as a new version of the library and update the version in your spreadsheet by double-clicking in your library

  • Related