title: Typo error: Cannot call method "getDataRange" of null
body: <p>Im trying to publish this code, But everytime when i run this code i get an error Cannot call method"getDataRange" of null. Please help me sort this out .Here is my code
  function </p>
  
  <pre><code>doGet() {  
  
  var ss = SpreadsheetApp.openById('sheet id');
  var sheet = ss.getSheetByName('sheet name');
  var data = sheet.getDataRange();
  
  var dateFilter= Charts.newCategoryFilter().setFilterColumnIndex(0).build(); 
  var ageFilter = Charts.newNumberRangeFilter().setFilterColumnIndex(7).build();
  var transportFilter = Charts.newCategoryFilter().setFilterColumnIndex(2).build();
  var nameFilter = Charts.newStringFilter().setFilterColumnIndex(1).build();
  
  var tableChart = Charts.newTableChart().setDimensions(700, 300)
                   .setDataViewDefinition(Charts.newDataViewDefinition().setColumns([0,1,2,3,4,5,6,7]))
                  .build();
  
  var pieChart = Charts.newPieChart()
                .setDataViewDefinition(Charts.newDataViewDefinition()
                .setColumns([1,7])).build();
  
  var dashboard = Charts.newDashboardPanel().setDataTable(data)
               .bind([dateFilter,ageFilter, transportFilter, nameFilter], [tableChart,    pieChart])
               .build();
  
  var app = UiApp.createApplication().setHeight(50);
  
  var todaysdate = new Date();
  app.add(app.createLabel(todaysdate));
  app.add(app.createHTML('&lt;h1 style="text-align:center;"&gt;DEMO&lt;/h1&gt;'));
  
  var filterPanel = app.createHorizontalPanel();
  var chartPanel = app.createHorizontalPanel();
  
  
  filterPanel.add(dateFilter).add(ageFilter).add(transportFilter).add(nameFilter).setSpacing(10);
  chartPanel.add(tableChart).add(pieChart).setSpacing(50);
  
  dashboard.add(app.createVerticalPanel().add(filterPanel).add(chartPanel));
  app.add(dashboard);
  
  var service = ScriptApp.getService();
  service.enable(service.Restriction.ALL);
  
  return app;
  }
  </code></pre>