labnol / apps-script-starter

Setup a local development environment inside Visual Studio Code and build Google Workspace add-ons with Google Apps Script

Home Page:https://www.youtube.com/watch?v=KxdCIbeO4Uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to setup a menu in bound google doc

namelus opened this issue · comments

@labnol

Thank you very much for this awesome repo.
Works like a charm!

I am new to webpack and babel and am trying to figure out how to setup a menu in my bound google doc.
Typically its onOpen () => { getUi; createMenu; createMenuItem } etc.

I tried adding it in a number of places, but it only works if I manually run the onOpen from the script editor. Also read about adding a trigger, but feel that is only a workaround.

Any help would be really appreciated.
Thanks in advance.

I've added a little example here on how you can add menus in container bound scripts.

https://github.com/labnol/apps-script-starter/blob/e7c193a5a5080e25e46f1fd02c703283b766a520/src/server/menu.js