I've a Google Sheets Published Addon with the following code to launch side bar on click of image in the sheet.
var ui = SpreadsheetApp.getUi();
function onOpen(e) {
addMenu();
if (e && (e.authMode == ScriptApp.AuthMode.LIMITED || e.authMode == ScriptApp.AuthMode.FULL)) {
insertImage();
}
}
function addMenu() {
var menu = ui.createAddonMenu();
menu.addItem('Launch', 'launchSidebar');
menu.addToUi();
}
function insertImage() {
try {
const spreadSheet = SpreadsheetApp.getActive();
const sheet = spreadSheet.getSheets()[0];
const gridImage = sheet.insertImage("https://www.google.com/images/srpr/logo3w.png", 10, 1);
gridImage.assignScript('launchSidebar');
} catch (error) {
Logger.log(error);
}
}
function launchSidebar(){
var template = HtmlService.createTemplateFromFile('sidebar');
var html = template.evaluate().setTitle('Add on');
ui.showSidebar(html);
}
When I click on image, I get the following error:
Google Apps Script: We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED.
It works fine when I am using google account associated with the script project but not working with other google accounts who uses the add-on as end user. Also, I am logged in using single account only in the browser.
Any suggestions would be appreciated.
Edit: I am not using multiple accounts; I've already checked those shared links and the solution on the post is to use single account which I am already doing. It didn't work on Incognito mode as well.
Please reopen the question.