I have a custom function in Google Apps Script called combineSheets() that is supposed to combine data from multiple sheets in a Google Sheets document. However, I noticed that the function does not update automatically when there are changes in the sheets.
function combineSheets() {
SpreadsheetApp.flush()
const ss = SpreadsheetApp.getActiveSpreadsheet();
const arrayData = [];
const sheets = ss.getSheets()
for (i = 0; i < sheets.length; i++) {
const sh = sheets[i];
const sheetName = sh.getName()
if (sheetName !== 'RESUMO' && sheetName !== '_BASE' && sheetName !== 'ESTADOS') {
const lastRow = sh.getLastRow();
const sourceValues = sh.getRange('B2:I').getValues();
arrayData.push(...sourceValues);
}
}
return arrayData;
}
Array combine from multiple sheets
0