You have to query each tab in the spreadsheet separately.  Depending on how 
your sheets are laid out, it may also be necessary to make multiple queries 
per tab if your charts need data from sections of the sheet that are laid 
out differently.

On Thursday, September 18, 2014 1:46:08 PM UTC-4, Chris Lusk wrote:
>
> Hey guys, I would like to pull data from a Google Sheet document and use 
> different tabs for different charts.  A column chart that pulls data from 
> tab number 1 and a gauge that pulls data from tab 2. This one seems even 
> trickier because I need to build a separate gauge for each of the reps and 
> just use the maximum files column and the current files column.
>
> Anywho, here is what I have so far (not much) ...
>
> <script type="text/javascript">
> google.load('visualization', '1', {'packages':['corechart']});
>
> // Set a callback to run when the Google Visualization library is loaded.
> google.setOnLoadCallback(drawChart);
>
> // Once everything is loaded; draw the chart here...
> function drawChart() {
>   var query = new google.visualization.Query(
>       '
> https://docs.google.com/spreadsheet/ccc?key=1LAHAW29fAeDc_vrQ9hpBKL0AO6nVB3XD_WMoFOXlBxA&usp=drive_web#gid=0'
> );
>
>   query.send(handleQueryResponse);
> }
>
> function handleQueryResponse(response) {
>   if (response.isError()) {
>     alert('Error in query: ' + response.getMessage() + ' ' + 
> response.getDetailedMessage());
>     return;
>   }
>
>   var data = response.getDataTable();
>   var chart = new 
> google.visualization.ColumnChart(document.getElementById('closing-product-bar-chart'));
> chart.draw(data, {
> legend: { position: 'right' },
> title: 'Closing Counts By Product',
> });
>   var chart = new 
> google.visualization.Gauge(document.getElementById('short-sale-by-rep-gauge'));
> chart.draw(data, {
> legend: { position: 'none' },
> title: 'Open File Capacity',
> });
> }
> </script>
>
> And in the body I currently have:
>
> <div id="closing-product-bar-chart" style="width:100%; height: 
> 350px;"></div>
> <div id="short-sale-by-rep-gauge" style="width:100%; height: 350px;"></div>
>
> So I am confused as how to call one master Google Sheet and then have each 
> chart use a certain tab, or certain cells within that Sheet.
>
> Thanks!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to