This seems to be something very simple but I have searched and not found a solution. I am trying to create a chart on my site based on the data in a google spreadsheet. I have been able to get it working using hard coded values but not sure how to fill from a spreadsheet.
My current script looks like this:
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000, 400],
['2005', 1170, 460],
['2006', 660, 1120],
['2007', 1030, 540]
]);
var options = {
title: 'Company Performance'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
My data on my spread sheet is simlilar to what is hard coded but I want to give it the spreadsheet url and have it fill it from that (url like this: https://docs.google.com/spreadsheet/ccc?key=0AnD0SFr9ooPgdG83Wm)