title: Unable to activate a sheet by name
body: <p>I'm trying to activate a monthly sheet upon opening the Spreadsheet, according to the current month.</p>
  
  <p>The problem is at the end of the script, when it fails selecting the sheet. It seems that <code>getSheetByName()</code> gets a <code>null</code> value, which is not accepted by <code>setActiveSheet()</code>. </p>
  
  <pre><code>function selectmonth(){
    var now= new Date();
    var month= now.getMonth()+1;  
    var ss=SpreadsheetApp.getActiveSpreadsheet();
    var sheetname="";
  
    switch (month){
      case 1:
        sheetname="urtarrila01";  //english=january01
        break;
      case 2:
        sheetname="otsaila02";    //english=february02 and so on...
        break;
      case 3:
        sheetname="martxoa03";
        break;
      case 4:
        sheetname="apirila04";
        break;
      case 5:
        sheetname="maiatza05";
        break;
      case 6:
        sheetname="ekaina06";
        break;
      case 9:
        sheetname="iraila09";
        break;
      case 10:
        etiketaizena="urria10";
        break;
      case 11:
        sheetname="azaroa11";
        break;
      case 12:
        sheetname="abendua12";
        break;      
      default:
        sheetname="LABURPENA-resumen";
    }
  
   //HERE mysheet gets null value, although the sheet exist, named "sheetname) 
    var mysheet=ss.getSheetByName(sheetname); 
    //AN HERE THE SCRIPT FAILS, ERROR MESSAGE=invalid argument on next line
    ss.setActiveSheet(mysheet);
  }
  </code></pre>
  
  <p>Well this is the final code that works:</p>
  
  <pre><code>enter code here
  
    function hileHonetan(){
    var now= new Date(); 
    var month= now.getMonth();
    var mysheetname="";
    var ss=SpreadsheetApp.getActiveSpreadsheet();
    var sheetNames= ['urtarrila01', 'otsaila02', 'martxoa03', 'apirila04',  'maiatza05',  'ekaina06', 'ekaina06', 'ekaina06', 'iraila09', 'urria10', 'azaroa11' , 'abendua12']
    mysheetname= sheetNames[month];
    var mysheet=ss.getSheetByName(mysheetname);
    mysheet.activate();
  
  }
  </code></pre>