我有以下情況。 公式電子表格中的某些列應該按順序進行復制,而不會將舊內容覆蓋到主電子表格文件中。將列值複製到另一個谷歌電子表格文件而不覆蓋
我設法下面的腳本
function copy() {
var ss = SpreadsheetApp.getActive(),
target =ss.getSheetByName('Sheet2'), //fill in the name of the sheet
lastColumn = target.getLastColumn(),
sourceVal = ss.getSheetByName('Sheet1').getRange("C1:C58")
.getValues();
target.getRange(1, lastColumn + 1, sourceVal.length, sourceVal[0].length)
.setValues(sourceVal);
var ss = SpreadsheetApp.getActive(),
target =ss.getSheetByName('Sheet2'), //fill in the name of the sheet
lastColumn = target.getLastColumn(),
sourceVal = ss.getSheetByName('Sheet1').getRange("H1:H58")
.getValues();
target.getRange(1, lastColumn + 1, sourceVal.length, sourceVal[0].length)
.setValues(sourceVal);
}
這會爲需要的列的工作量,它不會覆蓋舊的信息結合起來。
不幸的是,我不明白如何使這個工作與其他電子表格文件。
最終結果應該從10個文件中讀取,每個文件2列(列不是連續的)讀入最終的主文件。
在此先感謝您抽出時間。
這太棒了。 我理解它(不知何故),我可以根據要求進行更改。 非常感謝。 –