I'm trying to merge the information stored in multiple tabs in one master sheet such that it'll look like "Final" in this sample sheet. I found a code online that does something similar but merge the information row-wise, which is not ideal in my case. The code looks like this:
function merge() {
const ss = SpreadsheetApp.getActive();
const arr = ss
.getSheets()
.filter(s => !s.getName().includes('Master'))//exclude Master sheet
.flatMap(s => s.getDataRange().getValues());//map sheet to values and flatten it
ss.getSheetByName('Master')
.getRange(1, 1, arr.length, arr[0].length)
.setValues(arr);
}
Please let me know if you have any suggestions. Thanks in advance.