【问题标题】:Google Sheets error 400 "exceeds grid limits"Google 表格错误 400“超出网格限制”
【发布时间】:2021-10-18 21:42:40
【问题描述】:

我目前正在尝试使用 Chrome 获取工作表的 JSON 正文,但要合并到 python 脚本中。

https://sheets.googleapis.com/v4/spreadsheets/[spreadsheet_id]/values/[tab_name]?alt=json&key=[api_key]

工作表包含 56 行和 6 列,但出现错误:

{
  "error": {
    "code": 400,
    "message": "Range ('tab_name'!TAB_NAME) exceeds grid limits. Max rows: 994, max columns: 26",
    "status": "INVALID_ARGUMENT"
  }
}

我以为它不再喜欢 alt=json,但我得到了同样的错误,只是最后的键。

【问题讨论】:

    标签: google-sheets-api


    【解决方案1】:

    没有定义合适的范围

    我假设您正在尝试从工作表中获取值,根据 documentation 使用此端点的正确方法是 GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range} 您将 [tab_name] 定义为 URL 的一部分,它等于 SheetNamesheetName!A:Z,换句话说,错误表明您的请求超出了网格限制,因此您必须定义一个较小的网格,例如GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/Sheet1!A1:C5.

    作为建议,我鼓励您查看文档中的示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-11
      • 2022-09-29
      相关资源
      最近更新 更多