Not very familiar with Google App Scripts but trying to merge content from multiple tabs into one master sheet.
In addition, there are some tabs I want to ignore in the file. I know that by using logger, that the row referencing filteredSheets is working.
I want it to also ignore the header of each spread during merging of content and I've gotten this far. I suspect that I should be calling. Any help with this is greatly appreciated!
function mergeDirSheets() {
const master = "Global Data";
const ignoreSheets = ["Feedback"];
const dataRange = "A2:T";
const checkRange = "A2:A";
const ss = SpreadsheetApp.getActiveSpreadsheet();
const allSheets = ss.getSheets();
ignoreSheets.push(master);
const filteredSheets = allSheets.filter(s => ignoreSheets.indexOf(s.getSheetName()) == -1);
const valueMaster = master.getRange(2, 1, master.getLastRow(), master.getLastColumn()).getValues();
var sheets = ss.getSheets().reduce(function(acc, elem){
if (elem.getSheetName() != "Global Data") {
acc.push(elem);
}
return acc;
},[]);
for (var i = 0; i < sheets.length; i++){
var data = valueMaster.filter( function(item){
return item[2] === sheets[i].getfilteredSheets();
});
sheets[i].getRange("A2:C").clearContent();
sheets[i].getRange(2, 1, data.length, data[0].length).setValues(data);
}
}