Use Google Apps Script to create a custom menu that will work inside Google Sheets, Google Docs, Slides and Google Forms.
Tired of writing separate code for custom menus in Docs, Sheets, Slides, and Forms? This nifty Google Apps Script snippet by Amit Agarwal helps you build a universal menu that works across all these apps!
The solution is a small snippet which detects the context to see which of DocumentApp
, SpreadsheetApp
, FormApp
, SlidesApp
are available which then lets you switch to get the appropriate .getUI()
method.
Check out the source post for the full code and streamline your add-on development!
Source: How to Add a Universal Custom Menu to Multiple Google Workspace Apps – Digital Inspiration
Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.