【发布时间】:2019-07-22 20:30:05
【问题描述】:
function clearData() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var source_sheet = ss.getSheetByName("sheet");
var source_range = source_sheet.getRange("2:21");
var values = source_range.getValues();
var target = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1kNzG4IQrI9TSlGzpIjp_84uWzoraVDSLPyAS-RIJPh4/edit#gid=1047694951");
var target_sheet = target.getSheetByName("Deposits");
var target_range = target_sheet.getRange(2,1,values.length,values[19].length);// use the array size to define the range because the target column A is not necessarily the same size at this time.
target_range.setValues(values);
}
我已经为我的 google 表格创建了这个函数,但是它更新了相同的 20 行。我需要它做的是更新行,然后我有一个清除一个电子表格的 clear 函数,然后在前 20 行下添加另外 20 行,依此类推,一次有 20 行的追加行函数。
但是,我尝试的任何代码都不起作用。
我目前拥有的代码已附上。
有人可以帮忙吗?
【问题讨论】:
标签: google-apps-script google-sheets