1

我无法让这个公式在目标单元格中​​正常工作。我的公式符号有什么问题?

我试图使用下面的代码生成的有问题的公式应该如下所示=importRange("0Ak-----------------------VkE5M2c","部落成员!A1:D172")在目标单元格中​​。但它没有

 var source = SpreadsheetApp.getActiveSpreadsheet();
 var target = SpreadsheetApp.openById("0Ak-----------------------VkE5M2c");
 var insert_sheet = target.getSheetByName("Point Rank Sheet");
 var target_sheet = target.getSheetByName("clan members");
 var last_row = target_sheet.getLastRow();
 insert_sheet.insertRowAfter(last_row);     
 var values = source.getSheetByName("Form Data").getRange("A2:E2").getValues();
 target.getSheetByName("clan members").getRange("A"+(last_row+1)+":E"+(last_row+1)).setValues(values);
 var formula_cell = insert_sheet.getRange("A1:A1");
 var formula = '=importRange("0Ak-----------------------VkE5M2c","clan members!A1:D"+(last_row+1))';
 formula_cell.setFormula(formula)
4

1 回答 1

1

尝试:

var formula = '=importRange("0Ak-----------------------VkE5M2c","clan members!A1:D' + (last_row + 1) + '")';

于 2012-10-18T19:48:48.990 回答