我正在尝试更改单元格范围工作表!L2:L20为空白时,Newsletter!K6更改为“已完成”
function onEdit(e) {
var sheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Newsletter");
var sheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Worksheet");
var cell = sheet1.getRange(6,11).getValues();
var cells = sheet2.getRange(2,12,20);
var finished = "FINISHED";
if (cell === "FINISHED") {
cells.setValue("");
} else {
}
}
答案 0 :(得分:0)
将onEdit缩小到要监视的工作表和单元格,然后执行以下操作:
function onEdit(e){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = e.source.getActiveSheet().getName()
var editedCell = e.range.getSheet().getActiveCell().getA1Notation();
if(sheet=="Newsletter"){
if(e.value=="FINISHED"){
ss.getRange("Worksheet!L2:L20").clearContent()
}}}