Google 张 API returns 404

Google Sheets API returns 404

我正在关注 Google Docs API for javascript example to the letter, and got the basic example working. I have an api key, a secret token and I have set which ip addresses can access the data (http://localhost)。

演示有效,它显示了一个验证按钮,验证后我可以使用以下方法下载 google 的示例数据:

// google data example
var sheetId = "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms"

// load and show data
gapi.client.sheets.spreadsheets.values.get({
          spreadsheetId: sheetId,
          range: 'Class Data!A2:E',
        }).then(function(response) {
          console.log("loaded data " + response);
        });

问题是,如果我将 sheet id 替换为我自己的 google 文档 sheet 的 id,我会得到 Failed to load resource: the server responded with a status of 404.

我什至自己做了 sheet public。您可以在任何浏览器中直接查看它,甚至无需登录。但即便如此,我也无法使用 API 加载数据! (不过我不希望我的 sheet 变成 public)。

我缺少连接到我自己的数据的哪一步?

要真正让 Sheets Quickstart 为您自己的传播工作sheet,请确保您已经完成了这些事情:

  1. python -m SimpleHTTPServer 8080 一样启动一个本地网络服务器,这样您就可以实际连接到互联网。
  2. 提供正确的电子表格 ID
  3. 提供正确的 sheet 名称,以及 A1Notation 中的 sheet 名称。
  4. 以 A1 表示法提供正确的 sheet 范围。

    (我还删除了 API KEY 变量)

    这是我运行时的屏幕截图: