我想创建一个仪表板来代表我在谷歌电子表格中的一些数据,并且我尽可能地遵循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 });
}
}