Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 仅当单元格显示“已填充”时才能获取日期;是”;_Google Apps Script_Google Sheets - Fatal编程技术网

Google apps script 仅当单元格显示“已填充”时才能获取日期;是”;

Google apps script 仅当单元格显示“已填充”时才能获取日期;是”;,google-apps-script,google-sheets,Google Apps Script,Google Sheets,我需要更改以获取B列仅更新为“是”的日期 欢迎光临。请按照中的建议,添加您的搜索/研究工作的简要说明, function onEdit() { var s = SpreadsheetApp.getActiveSheet(); if (s.getName() == "EXPORTACION") { //checks that we're on Sheet1 or not var r = s.getActiveCell(); if (r.getColumn

我需要更改以获取B列仅更新为“是”的日期

欢迎光临。请按照中的建议,添加您的搜索/研究工作的简要说明,
function onEdit() {
  var s = SpreadsheetApp.getActiveSheet();
  if (s.getName() == "EXPORTACION") { //checks that we're on Sheet1 or not
    var r = s.getActiveCell();
    if (r.getColumn() == 2) { //checks that the cell being edited is in column B
      var nextCell = r.offset(0, 1);
      if (nextCell.getValue() === 'YES') //checks if the adjacent cell is empty or not?
        nextCell.setValue(new Date());
    }
  }
}
function onEdit(e) {
  var sh=e.range.getSheet();
  if(sh.getName()=="EXPORTACION" && e.range.columnStart==2 && e.value=="YES") { 
    e.range.offset(0,1).setValue(new Date());
  }
}