【问题标题】:How to retrieve JSON object from google sheets and not HTML如何从谷歌表格而不是 HTML 中检索 JSON 对象
【发布时间】:2020-02-25 06:46:52
【问题描述】:

我正在向已发布的谷歌表格发送 GET 请求。所有教程都显示返回了一个 JSON 对象,但我收到了 HTML。是因为更新吗?如何将其解析为 JSON?

已发布工作表:https://docs.google.com/spreadsheets/d/e/2PACX-1vTLSQ-WGM8O0iCCTal0eFoAvFFIVK04UxUiCuBJLGVy89EY301-0cF5PZupIXh-sF_L9pHIw6tVtN1G/pubhtml

转到链接时的预期输出:JSON 对象

获得的输出:HTML

参考资料: https://sandbox.idre.ucla.edu/sandbox/general/databasing-google-spreadsheets-to-json

https://medium.com/storyline-blog/how-to-create-a-dynamic-alexa-skill-using-google-sheets-and-storyline-9fd37f2080d8

在这些中,当我收到 HTML 时发出请求时返回 JSON

google sheet 返回 JSON 的示例:

https://spreadsheets.google.com/feeds/list/SPREADSHEET_ID/od6/public/basic?alt=json

【问题讨论】:

  • 哪个教程?您可能需要添加一个 url 查询参数
  • 我现在在问题中添加了它们@TheMaster
  • 不。如果我使用相同的 URL 模板,我会收到一个找不到页面的错误
  • 您好@SumanthSomshekhar,您能否发布完整的解决方案作为答案?因此遇到相同问题的其他人可以轻松解决。

标签: node.js json rest api google-sheets


【解决方案1】:

当您发布 google sheet 时,系统会弹出一个显示链接的提示,例如

https://docs.google.com/spreadsheets/d/e/2PACX-1vTVZ3fWRSMu5nFGUc05ACV1h0-UGW49wi9lHAyJVUMp8FX3TANqy_9WNhkcd4z1mJSSN-LZyyBdS_vK/pubhtml

2PACX-1vTVZ3fWRSMu5nFGUc05ACV1h0-UGW49wi9lHAyJVUMp8FX3TANqy_9WNhkcd4z1mJSSN-LZyyBdS_vK 不是技能ID

技能 ID 出现在搜索栏中。例如搜索栏有链接,https://docs.google.com/spreadsheets/d/1bm6Fjiacmuh0qRjuHoBU35AHPdF7S4R7BEIK46H0wUo/edit#gid=0

其中 1bm6Fjiacmuh0qRjuHoBU35AHPdF7S4R7BEIK46H0wUo 是链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-01-30
    • 2014-09-02
    • 2021-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多