How can I Copy/append all unique rows from SOURCE Spreadsheet to DESTINATION Spreadsheet.
This script works, but it copies all (including duplicates).
function transferIDs() {
var sss = SpreadsheetApp.openById('%'); //SOURCE
var ss = sss.getSheetByName('Sheet1');
var SRange = ss.getDataRange();
var A1Range = SRange.getA1Notation();
var SData = SRange.getValues();
var dss = SpreadsheetApp.openById('#'); //DESTINATION
var ds = dss.getSheetByName('Sheet1');
ds.clear({contentsOnly: true});
ds.getRange(A1Range).setValues(SData);
}
A | B |
---|---|
ID | Name |
X123456 | John |
Y112233 | Sarah |
X998877 | Amanda |
012344 | Bob |
X998877 | Amanda |
A | B |
---|---|
ID | Name |
X123456 | John |
Y112233 | Sarah |
X998877 | Amanda |
012344 | Bob |
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.