I'm currently trying to make a Google Sheets add-on for use by my office. I've gone through the work of getting it published privately in the marketplace and distributing it domain-wide, but I'm running into the issue of the menu items not being added properly. I've been reading about AuthMode, and from what I understand, my users will all be initially AuthMode.NONE, which should be able to add simple menus. Maybe my understanding of "simple menus" is different. I really need to get this working within a week before we switch all of our computers to ChromeOS (not my decision, IT's decision)
Here's what I assume should be all of the relevant code. Each function is properly defined as well.
function onOpen(e) {
SpreadsheetApp.getUi().createAddonMenu('Usage Macros')
.addItem('Summarize', 'firstRun')
.addSubMenu(SpreadsheetApp.getUi().createAddonMenu('Rate')
.addItem('PG&E', 'pge')
.addItem('CARE', 'care'))
.addSubMenu(SpreadsheetApp.getUi().createAddonMenu('Proposal Type')
.addItem('SunRun 0%', 'sunRun0')
.addItem('SunRun 1.9%', 'sunRun19')
.addItem('SunRun 2.5%', 'sunRun25')
.addItem('SunRun 2.9%', 'sunRun29')
.addItem('SunRun 3.5%', 'sunRun35')
.addItem('SunPower 0%', 'sunPower0')
.addItem('SunPower 2%', 'sunPower2')
.addItem('SunNova 0%', 'sunNova0')
.addItem('SunNova 0.9%', 'sunNova09')
.addItem('SunNova 1.9%', 'sunNova19')
.addItem('SunNova 2.9%', 'sunNova29')
.addItem('Cash', 'cash')
.addItem('GreenSky', 'greenSky')
.addItem('EnerBank', 'enerBank'))
.addItem('Finalize','kleanUp')
.addToUi();
}
function onInstall(e) {
onOpen(e);
}
I should also mention that the "Summarize" menu item and "firstRun" were added because originally the onOpen function called 2 other functions that changed some formatting and snipped useless info from the documents being opened. I removed that from the onOpen, and added a menu item for them, hoping it would help. Alas it did not.
onInstall()
function at the very top ofcode.gs
. I know that I've experienced some strange quirk in the past, but can't remember what it was. – Alan Wells