The result I get now gives me blank when that character is not there:
Code
const categories = catSubSheet.getRange(2, 1, catSubSheet.getLastRow() - 1, 3).getValues();
let categories1 = categories.filter(e => e[0] != '').map(function (e) { return e[0] });
let sheetsToProcess = [];
for (let a = 0; a < categories1.length; a++) {
sheetNames = categories1[a].substring(0, categories1[a].indexOf(" ("));
sheetsToProcess.push('BOQ ' + sheetNames)
}
Data
[
[GF HTG SHEET 1 (Drawing)],
[GF HTG SHEET 2 (Drawing)],
[GF DWS SHEET 1],
]
The result
Sheets to Process: BOQ GF HTG SHEET 1,BOQ GF HTG SHEET 2,BOQ
Expected Result
Sheets to Process: BOQ GF HTG SHEET 1,BOQ GF HTG SHEET 2,BOQ GF DWS SHEET 1