如何将自定义菜单添加到Google Sheet Addon

时间:2018-01-02 03:06:15

标签: google-apps-script google-apps-script-addon

我的Google表格插件没有启动自定义项目,我想在示例中显示“午餐”和“创建模板”子菜单IN autoCart Addon我们可以看到午餐按钮(如何实现这一点)

下面我附上了示例脚本

enter image description here

function onInstall(e) {
  onOpen(e);
}

function onOpen(e) {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .createMenu('Awesome Admin')
  
      .addItem('Launch Admin Console', 'showSidebar')
      .addItem('Create Tamplete', "newSheet")
      .addToUi();
}



function showSidebar() {
  var html = HtmlService.createHtmlOutputFromFile('index')
      .setTitle('G Suite Admin Console')
      .setWidth(400);
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
      .showSidebar(html);
}

1 个答案:

答案 0 :(得分:1)