This is a really newb question (I do apologise). - I have this script below that copies data from one sheet into another workbook. It works perfectly except I want to change the 'source' to a specific range (A4:E17):
function transferList() {
var sourceSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Cancellations");
var sourceData = sourceSheet.getDataRange().getValues();
var targetSS = SpreadsheetApp.openById("*****************").getSheetByName("Cancellations");
var targetRangeTop = targetSS.getLastRow();
targetSS.getRange(targetRangeTop 1,1,sourceData.length,sourceData[0].length).setValues(sourceData);
}
CodePudding user response:
Changed sourceSheet.getDataRange().getValues();
to sourceSheet.getRange("A4:E17").getValues();