我想創建一個儀表板來代表我在谷歌電子表格中的一些數據,並且我儘可能地遵循Google圖表指南(我不是程序員)。我想出了下面哪個腳本無法運行的腳本,我希望能夠幫助其實現。谷歌可視化腳本問題
這裏的鏈接到我的電子表格: https://docs.google.com/spreadsheets/d/1L2wjSj0IYSrA-dwYYly6rjmtw_zMCB6l7FB5B-rcvZc/edit#gid=1303777890
我試圖顯示爲柱形圖在Sheet2中(數據2)列d和E(高亮),我還說範圍內的URL數據查詢「range=D:E
」
我想出的代碼如下。我只是想讓它顯示圖表。任何幫助表示讚賞。
enter code here<html>
// Load the Visualization API and the corechart package.
google.charts.load('current', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawSheetName() {
var queryString = encodeURIComponent('SELECT D, E');
var query = new google.visualization.Query(
'https://docs.google.com/spreadsheets/d/1L2wjSj0IYSrA-dwYYly6rjmtw_zMCB6l7FB5B-rcvZc/edit#gid=1303777890range=D:E');
query.send(handleSampleDataQueryResponse);
}
function handleSampleDataQueryResponse(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('chart_div'));
chart.draw(data, { height: 400 });
}
}