0

My add-on has functionality to Export selected Chart as image from the sidebar into a google sheet. I have dynamically assigned script method callbackFunction1() to generated image using its Assign script. When i will click on the image, my Add-on need to be loaded in the sidebar. It is working fine when single clicked on it from publisher account but once any other end user, click on the image, following error occurred in Red,

You do not have access to perform that action. Please ask the owner of this item to grant access to you.

Please check attached screenshot for reference.

Callback code is:

function callbackFunction1(){
 var key="chart";
 var value="bar";
 var userProperties = PropertiesService.getDocumentProperties();
 userProperties.setProperty(key, value);

 SpreadsheetApp.getUi().showSidebar(    
        HtmlService.createTemplateFromFile('AddonGUI.html').evaluate().setTitle("AddOnTitle")
            .setSandboxMode(HtmlService.SandboxMode.IFRAME)
    );
}

This callback method is custom function.

Click here for error more detail

  • I believe what's happening is that when other users use the add-on they might not have access to the service, i think you should take a look at [this answer](https://stackoverflow.com/a/35123025/11581830) about running scripts as if it were the script's owner. [This answer](https://stackoverflow.com/a/52346510/11581830) also offers some important insight into this. Lastly, the [REST API](https://developers.google.com/apps-script/api/how-tos/execute) guide can show you how to manage the service. – AMolina Sep 24 '19 at 09:05
  • I have add-on not web app. So, i want that assign script method should be called once click on the image. I have observed that when callbackMethod is copied into relevant sheet script editor, then it is called and if not exists then error occurred. Can you please guide me in that either i can plugged related code into end user sheet's script editor during installations time or not. – Abid Mahmood Sep 25 '19 at 14:18

0 Answers0