I am trying to get ranges by using getRangeList
method but I am getting error Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Sheet.getRangeList
How can we do it?
function consolidateData() {
// defined all variables
var sheetNames = [];
var dataSheet = [];
var conso = [];
var ss = SpreadsheetApp.getActiveSpreadsheet();
var applyTo = ss.getSheetByName('Sheet10');
// get all sheets
var allsheets = ss.getSheets();
for (var s in allsheets) {
var sheet = allsheets[s];
sheetNames[s] = sheet.getName();
dataSheet[s] = ss.getSheetByName(sheetNames[s]);
// adding all sheet's data to a single variable
conso = conso.concat(dataSheet[s].getRange("A2:B" + dataSheet[s].getLastRow()).getValues());
// conso = conso.concat(dataSheet[s].getRangeList(["A2:B","D2:E"] + dataSheet[s].getLastRow()).getValues());
}
applyTo.getRange("A2:B" + (conso.length + 1)).setValues(conso);
// applyTo.getRangeList(["A2:B","D2:E"] + (conso.length + 1)).setValues(conso);
}