【问题标题】:how to use structured query in google sheets for fetching data in json format? [closed]如何在谷歌表格中使用结构化查询来获取 json 格式的数据? [关闭]
【发布时间】:2020-10-19 20:15:24
【问题描述】:

我正在从谷歌表格中获取 json 格式的数据。此表有用户信息。所以工作表中的一列是id 目前我正在获取所有工作表数据并在前端过滤掉。这需要时间来加载。因此,我阅读了有关 google sheet 的结构化查询的信息。我试过了,但不适合我。

这是我用来获取数据的http 请求

http://spreadsheets.google.com/feeds/list/spreadsheet_id/o7eb08/public/full?alt=json

我如何在 http 请求中使用结构化查询,但它不起作用

http://spreadsheets.google.com/feeds/list/ss_id/o7eb08/public/full?sq=id=75?alt=json

【问题讨论】:

    标签: javascript google-sheets query-string google-sheets-api


    【解决方案1】:

    解决方案

    您使用的查询字符串格式错误。 ? 符号用于在 URL 中指定查询字符串。这意味着在该符号之后,解析器将找到表示为key=value 的参数。

    在您的示例中,您使用了两次?

    http://spreadsheets.google.com/feeds/list/ss_id/o7eb08/public/full?sq=id=75?alt=json
                                                                     *^*      *^*
                                                                    USING "?" TWICE
    

    此处的解析器会将第二个? 符号解释为sq 值的一部分,从而导致无效参数错误。

    在 URL 中发送多个参数的正确方法是使用 & 符号:

    https://spreadsheets.google.com/feeds/list/spreadsheet_id/grid_id/public/full?sq=id=75&alt=json
    

    参考

    Query String

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-06
      • 2020-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多