You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无法访问Google Sheets API链接的JSON数据,求v4版本的访问链接格式

Google Sheets API v4 公开JSON数据访问方案

Google Sheets API v3 已正式弃用,原用于访问公开表格JSON数据的链接https://spreadsheets.google.com/feeds/list/<spreadsheet_id>/od6/public/values?alt=json已无法正常访问,会返回如下错误提示:

The Sheets v3 API has been turned down. Further information can be found at: https://cloud.google.com/blog/products/g-suite/migrate-your-apps-use-latest-sheets-api

前置要求

使用新链接前需先将目标Google Sheets表格的共享权限设置为「任何拥有链接的用户均可查看」,否则无法正常拉取公开数据。

最新JSON访问链接格式

通用格式如下:

https://docs.google.com/spreadsheets/d/<spreadsheet_id>/gviz/tq?tqx=out:json&sheet=<sheet_name>

参数说明

  • <spreadsheet_id>:替换为你的表格唯一ID,与原v3链接中使用的ID完全一致,也可从表格网页版地址栏d/和/edit之间的字符串中获取
  • <sheet_name>:替换为你需要读取的工作表名称,大小写敏感,若只需读取默认的第一个工作表,可直接省略&sheet=<sheet_name>参数

返回值处理

接口返回的内容开头会包含/*O_o*/\ngoogle.visualization.Query.setResponse(前缀,末尾包含)后缀,手动删除前后缀后即可得到标准JSON格式的表格数据。

内容的提问来源于stack exchange,提问作者Ashraf Sonde

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.02 04:54:02