Spreadsheet onOpen menu from a Library

后端 未结 4 1420
长发绾君心
长发绾君心 2020-12-10 17:33

I will distribute a spreadsheet with onOpen menu among several users. I would like to keep the menu definitions and functionality within a Library, so if I add some menu opt

4条回答
  •  既然无缘
    2020-12-10 17:59

    Good news! This works in the new Google Sheets. It's Apr 4, 2014 and you still have to go to your Google Drive settings and check "Use the new Google Sheets." (Caution: Beta = Bugs). This will only work in the new Sheets, if you're working on an Old Sheet it won't work.

    ~~in your library~~

    var menu = SpreadsheetApp.getUi().createMenu('Magical Menu');
    menu.addItem('Do The Thing', 'LibraryName.function_name');
    menu.addToUi();
    

    ~~~

提交回复
热议问题