我对这个脚本有点陌生,但对编程并不陌生——但我遇到了这个问题:
var appoved = "APPROVED";
ws.getRange(row, V).setValue(appoved); // Note: argument 3, 4, is optional actual worksheet
这是设置下面的代码和上面的行:
var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("2020members");
var data = ws.getRange("B2:U" + ws.getLastRow()).getValues();
data = data.filter(function(r){ return r[19] == true });
var V = 20; // Col 20 on sheet
data.forEach(function(row) {
ws.getRange(row, V).setValue(appoved); // This is the line with the problem
// unknown function error
}) ;
我想做的是将字母APROVED放在电子表格第五列的特定行中,单词APROVEd,然后移动到下一行,如果条件存在,则将相同的东西放在相同的位置,然后移动至下一行。
data.forEach(function(row,i) {
ws.getRange(i+2, V).setValue(appoved); // This is the line with the problem
forEach方法的第二个参数是索引,您可以获取索引and起始行Get Get range方法的签名所需的当前行号。