Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Copy data from Google Sheet A to Google Sheet B
- function cloneImportData(ssA, ssB) {
- // source doc
- var sss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1t93TiemQfXWkMhOxKtCyjkzPkE6WF-ce1CnQgVDfJfc/edit#gid=1312573476')
- // source sheet
- var ss = sss.getSheetByName('ImportData');
- // Get full range of data
- var SRange = ss.getDataRange();
- // get A1 notation identifying the range
- var A1Range = SRange.getA1Notation();
- // get the data values in range// Copy data from Google Sheet A to Google Sheet B
- function cloneImportData(ssA, ssB) {
- // source doc
- var sss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1t93TiemQfXWkMhOxKtCyjkzPkE6WF-ce1CnQgVDfJfc/edit#gid=1312573476')
- // source sheet
- var ss = sss.getSheetByName('ImportData');
- // Get full range of data
- var SRange = ss.getDataRange();
- // get A1 notation identifying the range
- var A1Range = SRange.getA1Notation();
- // get the data values in range
- var SData = SRange.getValues();
- // target spreadsheet
- var tss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1t93TiemQfXWkMhOxKtCyjkzPkE6WF-ce1CnQgVDfJfc/edit#gid=1312573476')
- // target sheet
- var ts = tss.getSheetByName('CachedData');
- // Clear the Google Sheet before copy
- ts.clear({contentsOnly: true});
- // set the target range to the values of the source data
- ts.getRange(A1Range).setValues(SData);
- };
- var SData = SRange.getValues();
- // target spreadsheet
- var tss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1t93TiemQfXWkMhOxKtCyjkzPkE6WF-ce1CnQgVDfJfc/edit#gid=1312573476')
- // target sheet
- var ts = tss.getSheetByName('CachedData');
- // Clear the Google Sheet before copy
- ts.clear({contentsOnly: true});
- // set the target range to the values of the source data
- ts.getRange(A1Range).setValues(SData);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement