我是新手Google表格,尝试在更新时添加触发器,但收到错误:
TypeError:无法从未定义中读取属性“ range”。 (第3行,文件“代码”)
代码:
function onEdit(e){
//Access the range with your parameter e.
var range = e.range;
var spreadSheet = SpreadsheetApp.openById("18AmVxMf8Q2oWvAsfh2KJ6hR-gC1FH6goul9Vocike1w");
var column=e.range.getColumn();
var row = e.range.getRow();
var cell = e.range.getA1Notation();
//do whatever you need with that range
var allcolumns=[2,3];
if(allcolumns.indexof(column)>-1){
for (var i=column+1;i<column+2;i++){
SpreadsheetApp.getactivesheet().getrange(row,i).setvalue(e.value);
}
SpreadsheetApp.getactivesheet().getrange(cell).setvalue('');
}
}