[英]function onEdit doesn't fire in Google sheet add-on
我正在構建一個簡單的Google Sheet加載項,在我的代碼中,我具有onEdit()
函數( 根據文檔 )應在用戶更改某些單元格時觸發,但事實並非如此!
這是我的代碼:
function onOpen() {
SpreadsheetApp.getUi().createMenu('Scheduller')
.addItem('Some item', 'Some item')
.addToUi()
}
// This function is not called when the user change the value of some cell
function onEdit(e){
var range = e.range
range.setNote('Last modified: ' + new Date())
}
有什么建議嗎?
為了onEdit
事件,您需要設置一個觸發器。
您可以通過編程方式做到這一點:
ScriptApp.newTrigger('onEdit')
.onEdit()
.create();
或者您可以手動完成 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.