The following question/answer appears to answer the question of how to filter a Google Sheets array to those with a particular term in the name:
- Result
CodePudding user response:
Sheets that do not include a string
function myFunction(s = "ee") {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const allSheets = ss.getSheets().filter(sh => !~sh.getName().indexOf(s));
const allSheets_names = allSheets.map(sheet => sheet.getSheetName())
const neededSheets = ["tree"];
const filteredListOfSheetsNames = []
neededSheets.forEach(ns =>
allSheets_names.forEach((as, index) => { if (as.indexOf(ns) > -1) { filteredListOfSheetsNames.push(as) } }))
const filteredListOfSheets = filteredListOfSheetsNames.map(name => ss.getSheetByName(name))
}
Includes sheets whose names do not include ee