Returns all sheets names of a google spreadsheet

I am loocking for the list of all sheets names of a google spreadsheet.

 var outString="";
 var ss = SpreadsheetApp.getActive();
 var namedRanges = ss.getNamedRanges();
return ContentService.createTextOutput(outString);

Not strictly an AI2 question!

function sheetnames() {
  var out = new Array()
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  for (var i=0 ; i<sheets.length ; i++) out.push( [ sheets[i].getName() ] )
  return out 


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.