I am trying to publish a Google apps script Sheets Add-on.
In the editor the complete 'Directions' submenu is added to the Add-ons menu.
This is the submenu:
Directions >
Prepare sheet...
Generate step-by-step...
But when the add-on is published and a new spreadsheet is opened,
the 'Directions' submenu is added to the Add-ons menu,
but the 2 items are not added to the 'Directions' submenu. and there is an error message:
Error Exception: You do not have permission to perform that action. at onOpen(Code:10:36)
I have:
Code.gs
function onOpen() {
SpreadsheetApp.getUi()
.createAddonMenu()
.addItem('Prepare sheet...', 'prepareSheet_')
.addItem('Generate step-by-step...', 'generateStepByStep_')
.addToUi();
}
/**
* A function that adds headers and some initial data to the spreadsheet.
*/
function prepareSheet_() {}
/**
* Creates a new sheet containing step-by-step directions between the two
* addresses on the "Settings" sheet that the user selected.
*/
function generateStepByStep_() {}
See also Custom Menus in Google Workspace .
Sample:
function onOpen() {
var ui = SpreadsheetApp.getUi()
ui
.createAddonMenu()
.addSubMenu(ui.createMenu('Prepare sheet...')
.addSubMenu(ui.createMenu('Generate step-by-step...')
.addItem("Help", 'generateHelp_')))
.addToUi();
}
Note:
When you publish your Add-on, Google will add an additoinal default Help
menu to the Add-on menu - in addition to your Help menu that is nested inside of Generate step-by-step...
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.