TypeError:无法从未定义中读取属性“ source”。 (第2行,文件“代码”)

时间:2019-10-07 09:23:12

标签: date google-apps-script triggers watch stamp

我的脚本中有一些代码可以正常工作,现在由于某种原因,它给了我这个问题的标题错误

代码如下

    function onEdit(e) {
        var sheet = e.source.getActiveSpreadsheet(),
       columnToWatch = 10,
       columnToStamp = 9, //change all of these to your needs...1 is column A, 2 is column B, etc
       excluded = ["KEY CODE","Form Responses 1","Hub List"]; //add names of sheets/tabs to this 
       list. The script will not work on these sheets.
       if (e.source.columnStart !== columnToWatch ||  !e.value || excluded.indexOf(sheet.getName()) 
       > -1) return;
    sheet.getRange(e.source.rowStart, columnToStamp)
        .setValue(new Date()).setNumberFormat("dd.MM.yy");  

}

任何帮助将不胜感激!

0 个答案:

没有答案