通过Appscript启动Google表单作为自定义菜单

时间:2017-11-14 23:20:52

标签: google-apps-script google-sheets google-form

我正在尝试通过App Script启动我在Google表格中创建的Google表单。该脚本不起作用,我不确定需要做些什么来解决它。这是脚本:

function onOpen() {
    var ui = SpreadsheetApp.getUi();
  // Or DocumentApp or FormApp.
    ui.createMenu('Custom Menu')
      .addItem('Edit/Delete', 'menuItem1')
      .addSeparator()
      .addItem('New Entry', 'menuItem2')
      .addToUi();
    }

function menuItem1() {
    SpreadsheetApp.getUi () // Or DocumentApp or FormApp.
     .alert('You clicked the first menu item!');
    }

function menuItem2() {
// Open a fom.     var form =  FormApp.openByUrl('https://docs.google.com/forms/d/e/1FAIpQLSfYrw3nwiYt6p8bPEqyV0GD8hpnaFOfa1i4LHYMo01GPPM6dQ/viewform');
     }

0 个答案:

没有答案