【问题标题】:google.visualization.Query does not seem to work on my code anymoregoogle.visualization.Query 似乎不再适用于我的代码
【发布时间】:2022-01-11 20:54:34
【问题描述】:

我正在清理几年未使用过的旧 html 页面,该页面从 google 表格中提取数据。我有一堆在几年前工作得很好但不再工作了。

这是我的 Javascript 中失败的代码:

var docfile = new google.visualization.Query('https://spreadsheets.google.com/pub?key=10LWh5nrLxxxxxxxxxxxxxxx', {sendMethod: 'auto'});
docfile.setQuery('select A, B, C, D, E, F');
docfile.send(handleQueryResponse);

当我加载页面时出现此错误:

TypeError: Cannot read properties of undefined (reading 'Query')

电子表格仍然存在,具有相同的key ID,并且没有任何变化。

是否不再支持google.visualization.Query
有没有新的方法来引用谷歌表格中的数据?

【问题讨论】:

标签: google-maps-api-3 google-sheets-api google-api-java-client


【解决方案1】:

根据documentation(并且因为它是“旧的html页面”),您可以尝试更新Library Loader Code

<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>
  google.charts.load('current', {packages: ['corechart']});
  google.charts.setOnLoadCallback(drawChart);
  ...
</script>

【讨论】:

    猜你喜欢
    • 2019-10-14
    • 2022-06-13
    • 1970-01-01
    • 1970-01-01
    • 2021-11-13
    • 2017-03-28
    • 2019-10-23
    • 2013-02-15
    • 1970-01-01
    相关资源
    最近更新 更多