title: Accessing spreadsheet in Google Script
body: <p>I am writing a google script on top of a spreadsheet.
  I want to deploy it as a web app.
  It shows some values.
  Unfortunately, with my current code, google reminds me:</p>
  
  <blockquote>
    <p>TypeError: Cannot call method "getSheetByName" of null.</p>
  </blockquote>
  
  <p>I have no idea where the mistake is.</p>
  
  <p>Here's the code</p>
  
  <pre><code>function doGet(e) {
      var app = UiApp.createApplication().setTitle('Details');
      var ss = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
      var dataFromCell = ss.getRange("B4").getValue();
  
      var mypanel = app.createVerticalPanel();
      var label = app.createLabel(dataFromCell);
  
      app.add(mypanel);
      app.add(label);
  
      return app;
  }
  </code></pre>