Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MasterSheetBackup() {
- var sss = SpreadsheetApp.openById('16F8fstwI61rOgl2iNnlrwsyQOcqnSJ2Nj8zXJJFJLAk'); //replace with source ID
- var ss = sss.getSheetByName('MasterSheet'); //replace with source Sheet tab name
- var range = sss.getRange('A:CW'); //assign the range you want to copy
- var data = range.getValues();
- var tss = SpreadsheetApp.openById('1yQGyrwDWC0Xp3fUDl0heD5IEz5IumpjilrZnzlLN2jc'); //replace with destination ID
- var ts = tss.getSheetByName('MasterSheetBackup'); //replace with destination Sheet tab name
- ts.getRange(1, 1, data.length, data[0].length).setValues(data);
- }
- function masterSheetBackup(ssA, ssB) {
- // source doc
- var sss = SpreadsheetApp.openById('1M7-l6gJdtoDVD7v9NBa1thESyTbclRhiuvgYTnjpNxI');
- // source sheet
- var ss = sss.getSheetByName('masterSheet');
- // 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.openById('1UHPtXJj2-N-STEzh65ZlXbeAcCoxuVLIzCvgh2qcalA');
- // target sheet
- var ts = tss.getSheetByName('masterSheetBackup');
- // 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