After refreshing the shared spreadsheet, onOpen is not running to other users who also have access.
But the owner is being able to run the codes and script.
Code.gs
function onOpen(e) {
test();
SpreadsheetApp.getUi() // Or DocumentApp, SlidesApp, or FormApp.
.createMenu('Custom Menu')
.addItem('First item', 'menuItem1')
.addToUi();
SpreadsheetApp.getUi() // Or DocumentApp, SlidesApp, or FormApp.
.createMenu('Custom Menu').addItem('Test', 'test').addToUi();
};
function test() {
var ui = SpreadsheetApp.getUi(); // Same variations.
var result = ui.prompt('Spreadsheet Restriction', 'Enter password:', ui.ButtonSet.OK);
// Process the user's response.
var button = result.getSelectedButton();
var text = result.getResponseText();
if (button == ui.Button.OK) {
// User clicked "OK".
} else if (button == ui.Button.CLOSE) {
// User clicked X in the title bar.
ui.alert('Spreadsheet is protected.');
test();
}
};
function myFunction() {
}
Already shared the access spreadsheet and script to other users but they can't still see it is working. Appreciate your help guys... Thanks!