如何调整 Google 图表 (WordTree) 以从 Google 工作表 URL 获取数据源?

How to adjust Google Charts (WordTree) to take data source from Google sheets URL?

我想获取从 Google sheets URL 创建的 WordTree 作为数据源

wordTree 图表位于: https://developers.google.com/chart/interactive/docs/gallery/wordtree

并且可以找到更改数据源 https://developers.google.com/chart/interactive/docs/drawing_charts

但是我一直出错,无法获取 sheet 并且代码没有 运行

似乎可以使用图表包装器 class...

google.charts.load('current', {
  packages: ['wordtree']
}).then(function () {
  var chart = new google.visualization.ChartWrapper({
    chartType: 'WordTree',
    containerId: 'chart',
    dataSourceUrl: 'https://docs.google.com/spreadsheets/d/1loB8SHnERMVCyjaWWkWi-ADmA99Yjf4FrgGD-oPUPdA/edit?usp=sharing',
    query: 'SELECT A,B',
    options: {
      wordtree: {
        format: 'implicit',
        word: 'patio'
      }
    }
  });
  chart.draw();
});

确保 query 属性 设置为拉取包含数据的列。

见下文fiddle...
https://jsfiddle.net/WhiteHat/L0vmk2tq/