Answer the question
In order to leave comments, you need to log in
How to execute a script on all sheets of a table?
Help to correct the script so that it does the same but cuts data from all sheets expressed and inserted into another table on sheet "Sheet3"
function copyTabList() {
var from = SpreadsheetApp.getActiveSheet();
var fromValues = from
.getDataRange()
.offset(1, 0)
.getValues();
var fromData = fromValues;
var tss = SpreadsheetApp.openById('Id');
var ts = tss.getSheetByName('Sheet3');
ts.getDataRange()
.offset(1, 0)
.clearContent()
.getSheet()
.getRange(2, 1, fromData.length, fromData[0].length)
.setValues(fromData);
}
Answer the question
In order to leave comments, you need to log in
You can get a list of all sheets and loop through. Copy the data in the same way, but change the line number when inserting (here 2 is replaced by (last line of data on the sheet + 1))
.getRange(2, 1, FromData.length, FromData[0].length)
={1;2;3}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question