<html>
<head>
<script src="https://www.gstatic.com/charts/loader.js" type="text/javascript">
</script>
<script type="text/javascript">
var dataSource = "https://docs.google.com/spreadsheets/d/1qj7LsoiTAcPbOfEVF2itRwhcBLuQpfmvQ7sQ8OtBP7s/edit?usp=sharing";
google.charts.load('current', { 'packages': ['corechart'] });
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var opts = { sendMethod: 'auto' };
var query = new google.visualization.Query(dataSource, opts);
// Optional request to return only column C and the sum of column B, grouped by C members.
query.setQuery('select B, C');
// Send the query with a callback function.
query.send(handleQueryResponse);
}
function handleQueryResponse(response) {
if (response.isError()) {
alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return;
}
var data = response.getDataTable();
var options = { title: 'Company Performance' };
var chart = new google.visualization.PieChart( document.getElementById('piechart') );
chart.draw(data, options);
}
/*
* Plunker Auth: José A. Zulbarán R.
* Source:
* http://stackoverflow.com/questions/21536602/fill-a-google-chart-with-data-from-a-google-spreadsheet
*
* thanks to
* http://stackoverflow.com/users/2271039/azzurroverde
*/
</script>
</head>
<body>
<div id="piechart" style="width: 900px; height: 500px;"></div>
</body>
</html>