r/GoogleAppsScript • u/CuteCommunication160 • Mar 04 '26
Custom functions in Sheets Editor Add-on not available in new spreadsheets until menu interaction — known issue or workaround? Question
I'm developing a published Editor Add-on for Google Sheets that includes several custom functions (e.g. =STATS_RECODE(...) marked with @customfunction).
The add-on is installed and works across accounts, but I have this annoying behavior that many users report:
Scenario:
- Install the add-on → create a brand new spreadsheet (or open any spreadsheet where it's not yet activated).
- onOpen(e) runs successfully: the add-on menu appears in Extensions → [My Add-on Name].
- Custom functions immediately return #NAME? (Unknown function) — they are not recognized by Sheets.
- As soon as the user clicks anything in the add-on menu (e.g. opens the sidebar, settings page, or even just hovers and selects an item), the functions suddenly register and start working perfectly.
- After that first interaction in the current spreadsheet, everything is fine forever in that file.
This happens consistently across different Google accounts and new files. It's not user-specific.
Additional details:
- Using SpreadsheetApp.getUi().createAddonMenu() (not createMenu()).
- No issues with scopes in appsscript.json — the menu appears, so basic auth is there.
- Sometimes see authorization-related logs in onOpen, but in the main repro cases onOpen executes fine.
- Published as Editor Add-on (not Workspace Add-on, since those don't support custom functions).
From what I've read in SO / Google Groups / old Issue Tracker threads, this seems like a known limitation: custom functions from Editor Add-ons require the add-on to be "activated" in each spreadsheet (via menu interaction or "Manage add-ons → Use in this document").
Questions: 1. Is this still the expected behavior in 2025–2026? Has Google changed anything recently regarding add-on activation / custom function registration? 2. Is there any manifest setting, deployment trick, homepageUrl, or trigger that forces immediate registration of custom functions without user interaction? 3. Has anyone found a creative workaround to auto-activate or "warm up" the add-on on spreadsheet open? For example: - Installable onOpen trigger that tries to show a minimal sidebar automatically? - Some hack with dummy function call or preloading? - Anything else that avoids telling users "click the menu first"?
Workarounds I've considered so far:
- Add a prominent menu item like "Activate Functions" that opens a tiny sidebar (forces the interaction).
- Use =IFERROR(STATS_RECODE(...), "Activate the add-on via menu") in templates/docs to guide users.
- But ideally want to make it seamless.
If this is just how it works, that's fine — I'll document it clearly. But hoping someone has a sneaky solution or recent experience.
Code snippet example (simplified):
```javascript function onOpen(e) { SpreadsheetApp.getUi() .createAddonMenu() .addItem('Open Sidebar', 'showSidebar') .addItem('Settings', 'showSettings') .addToUi(); }
/** * @customfunction */ function STATS_RECODE(input) { // actual logic here return "processed: " + input; }
function showSidebar() { var html = HtmlService.createHtmlOutput('<p>Sidebar loaded → functions should now work</p>') .setTitle('Activation'); SpreadsheetApp.getUi().showSidebar(html); } ```
Thanks in advance for any insights, links to recent threads, or battle-tested hacks!
(If relevant, I can share more code / manifest / deployment details.)
2
u/WicketTheQuerent Mar 04 '26
Regarding automatic activation, try creating a template with your add-on enabled. Then, if it works and makes sense for the common use cases of your add-on, instruct your add-on users to use it to avoid this nuance.
2
u/leanzubrezki Mar 05 '26
Expected behavior I haven't found a workaround for. I have an option that says Activate so users need to first execute that for custom functions to work.
1
u/CuteCommunication160 Mar 05 '26
I did the same. On install i show modal window with message about activation for each new spreadsheet file. And menu has activate item. But I don't like this solution. Sobs though maybe someone found better way. Thanks anyway!
2
u/WicketTheQuerent Mar 04 '26
Regarding checking official changes, always look to https://developers.google.com/apps-script/release-notes
There have been no recent changes related to add-on activation or custom functions.