I have this function looping through all sheets, and if the sheet is not hidden, add the sheet name to the array out
.
function sheetnames() {
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var out = new Array()
for (var i=0 ; i<sheets.length ; i++)
if (sheets[i].isSheetHidden()!= true){
out.push( [ sheets[i].getName() ]
)}
Logger.log(out);
}
I would also like to test for specific sheet names, which I am able to do with
if (sheets[i].getSheetName()!= 'Sheet1'){
However when I put them together with ||
an OR operator, both tests are ignored.
if (sheets[i].isSheetHidden()!= true || sheets[i].getSheetName()!= 'Sheet1'){
I'm not sure if it is the way I am handling ||
or something else I'm not seeing.
In this example, sheet1 is visible, so would pass the first part of the test.