Scripts not working for anonymous users, Google Spreadsheet

I am currently editing a Google spreadsheet that is configured for public editing by logins and anonymous users (I am not the owner). I created a script in a spreadsheet and assigned it to a drawing (Insert Drawing). I also assigned the script to the image.

There are two unfortunate oddities: 1) The picture is not displayed if you are anonymous (am I using incognito mode?). You can see this checkbox and right-click for the menu (and even remove it), but the picture itself is not displayed. For some reason, you also cannot add a new drawing as an anonymous user - you get "Permission required" and a curious "You are logged in". The image does appear and you can add your own images 2) Scripts do not run for anonymous users - either the script assigned to the image (apparently) or the script attached to the drawing.

The script in the image looks like this:

function messageBarnImage() {
  Browser.msgBox("there is a message here")
}
      

Run code


The script runs fine when I am logged in.

I wonder if the issue is related to this answer: https://stackoverflow.com/a/1180940/ ... but I don't have enough reputation to comment on this (I don't understand what that means) and I'm not sure if it's the same.

Question: how do I display and run my scripts for script buttons?

+1


source to share


1 answer


The post you link to has a clear answer: any call to the spreadsheet service will require a work permit. This implicitly excludes anonymous users . See Zig Mandel's answer for an explanation of how to solve this (reproduced below)



The button runs under user rights. If its anonymous it won't start if it needs any api permission (like reading spreadsheet) as there is no user. For non-anonymous users, you need to add a menu item that will bring up the google permission dialog (just make some dumb api call from it). After the user approves, they can click the image button

+2


source







All Articles