title: Apps Script chart dashboard binding to Google Spreadsheet as data source
body: <p>It says in the <a href="https://developers.google.com/apps-script/articles/charts_dashboard" rel="nofollow">charts dashboard tutorial</a> that the dashboard can be bound to a Google Spreadsheet range as a data source. But this was not demonstrated in the tutorial, nor could I find relevant info in the <a href="https://developers.google.com/apps-script/class_datatable" rel="nofollow">Apps Script docs</a>. It seems that Datatable cannot be bound to a spreadsheet range, as the methods only provide for adding rows and columns manually. </p>
  
  <p>Does anyone know how to bind the dashboard to a range from Google Spreadsheet?</p>
  
  <p>In my current code, I am assuming that the dashboard can be bound to a range from Google Spreadsheet like so, but the setDataTable function call is giving me a hard time.</p>
  
  <pre><code>var ss = SpreadsheetApp.openById(spreadsheetId);
  var data = ss.getRangeByName("DataWithColHeadings");
  var dashboard = Charts.newDashboardPanel()
    .setDataTable(data) // throws error here! I think it is expecting a DataTableBuilder
    .bind([durationFilter, lineFilter], [pieChart, tableChart])
    .build();
  </code></pre>