1
我正在嘗試爲Google表格創建一個腳本。我創建了一個腳本,並試圖「作爲插件測試」,但在「測試」它時似乎沒有做任何事情。我從developers.google.com中提取了這段代碼,它是一個創建自定義菜單的簡單腳本。當我試圖測試它時,表單打開但沒有任何反應。自定義菜單不顯示。有什麼建議麼?在此先感謝...作爲附件測試不起作用
function onOpen() {
var ui = SpreadsheetApp.getUi();
// Or DocumentApp or FormApp.
ui.createMenu('Custom Menu')
.addItem('First item', 'menuItem1')
.addSeparator()
.addSubMenu(ui.createMenu('Sub-menu')
.addItem('Second item', 'menuItem2'))
.addToUi();
}
function menuItem1() {
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.alert('You clicked the first menu item!');
}
function menuItem2() {
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.alert('You clicked the second menu item!');
}