Google表格上写着“完成的脚本”,但没有任何结果

时间:2018-06-17 05:01:12

标签: google-apps-script google-sheets

我有两个标签 - 正在进行和已完成。如果列A显示“已完成”,我想移动整行。该脚本已运行,并且有一条通知显示“已完成的脚本”,但没有任何反应。第1列是一个公式 但我想将它们作为值粘贴在“已完成”标签

    function onEdit(event) {
  // assumes source data in sheet named In Progress
  // target sheet of move to named Completed
  // test column with Completed is col 1 or A
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = SpreadsheetApp.getActiveSpreadsheet();
  var r = SpreadsheetApp.getActiveRange();

  if(s.getName() == "In Progress" && r.getColumn() == 1 && r.getValue() == "Completed") {
    var row = r.getRow();
    var numColumns = s.getLastColumn();
    var targetSheet = ss.getSheetByName("Completed");
    var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
    s.getRange(row, 1, 1, numColumns).moveTo(target);
    s.deleteRow(row);
      }
    }

GoogleSheetScreenshot

1 个答案:

答案 0 :(得分:0)

脚本包含条件

var add_to_group; add_friend = "CODE:"; add_friend += "SET !TIMEOUT_STEP 1" + "\n"; add_friend += "TAG POS={{i}} TYPE=BUTTON ATTR=TXT:Accept<SP>Request" + "\n"; var i = 1; while (i < 7) { if (if the button says 'Accept Request' then click it") { // This is where I don't know what to put iimSet("i", i); // Clicks the button iimPlay(add_to_group); } i++; }

  1. 如果未满足任何条件,则脚本将不执行任何操作
  2. onEdit是一个简单编辑触发器的保留函数名称,它仅在用户进行更改时触发,而不是在重新计算公式时触发。