I found code for listing the names of all sheets in Google Sheets (from here ):
function SheetNames() { // Usage as custom function: =SheetNames( GoogleClock() ) try { var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets() var out = new Array( sheets.length+1 ) ; //out[0] = [ "Name" , "gid" ]; for (var i = 1 ; i < sheets.length+1 ; i++ ) out[i] = [sheets[i-1].getName()]; return out } catch( err ) { return "#ERROR!" } }
My question is how to change the script to skip the first two sheet names and start filling out the list in the cell where the script is being called?
I tried changing var i = 1 to var i = 3 and skipped the first two sheet names, but also created empty cells. How to skip the first two sheet names and not create empty cells?
google-spreadsheet google-apps-script google-spreadsheet-api
Nathan
source share