从电子表格数据 API 中检索 JSON Feed 的简单示例
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
警告:本页面介绍的是 Google 的旧版 API,即 Google 数据 API;它仅与 Google 数据 API 目录中列出的许多 API 相关,其中许多 API 已替换为较新的 API。如需了解特定新 API,请参阅新 API 的文档。如需了解如何使用较新的 API 向请求授权,请参阅 Google 帐号身份验证和授权。
简介
此示例演示了如何使用电子表格数据 API 提供的 JSON 输出格式显示电子表格中特定工作表的列表或单元格 Feed。这样,您就可以查询电子表格的公开列表或单元格 Feed,并获得返回的结果作为 JSON 对象。要使用新的 JSON Feed,请创建一个 src
值为
http://spreadsheets.google.com/feeds/feed/key/worksheet/public/basic?alt=json-in-script&callback=myFunc
其中,feed
是 Feed 的类型,key
是要检索的电子表格的键,worksheet
是工作表的位置或唯一标识符,myFunc
是传递给 JSON 对象的回调函数的名称。如需详细了解 Google 数据 API 的 JSON 输出支持,请参阅我们的 JSON 输出支持文档。
注意:只有已发布的电子表格才支持在没有身份验证的情况下检索 Feed。
注意:在支持 JSON 输出时,还可以使用其他 Feed 类型以及可见性和投影值。如需详细了解其他 Feed 类型以及公开范围和投影值,请参阅 电子表格数据 API 文档。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-03-01。
[null,null,["最后更新时间 (UTC):2023-03-01。"],[],[],null,["# Simple example of retrieving JSON feeds from Spreadsheets Data API\n\n**Warning** : This page is about Google's older APIs, the Google Data APIs; it's relevant only to the APIs that are listed in the [Google Data APIs directory](/gdata/docs/directory), many of which have been replaced with newer APIs. For information about a specific new API, see the new API's documentation. For information about authorizing requests with a newer API, see [Google Accounts Authentication and Authorization](/accounts).\n| Version v4 of the [Google Sheets API](/sheets) is now available! This [migration guide](/sheets/guides/migration) shows how to update applications to use v4.\n\n### Introduction\n\nThis sample demonstrates displaying a list or cells feed for a particular worksheet in a spreadsheet using the JSON output format provided by the Spreadsheets Data API. This allows you to query a spreadsheet's public list or cell feed and get the resulting entries returned as JSON objects. To use the new JSON feed, create a script element whose `src` value is\n\u003e `http://spreadsheets.google.com/feeds/`**feed** `/`**key** `/`**worksheet** `/public/basic?alt=json-in-script&callback=`**myFunc**\n\nwhere **`feed`** is the type of feed, **`key`** is the key of the spreadsheet you want to retrieve, the **`worksheet`** is the positional or unique identifier of the worksheet, and **`myFunc`** is the name of your callback function that is passed the JSON object. For more information on JSON output support for Google Data APIs please see our [JSON output support documentation](/gdata/json).\n\n**Note:** Retrieving a feed without authentication is only supported for published spreadsheets.\n\n**Note:** Other feed types and visibility and projection values may be used with JSON output support. For more information on other feed types, and visibility and projection values please see the [Spreadsheets Data API](/google-apps/spreadsheets) documentation.\n\n### Demo\n\nSpreadsheet: http://spreadsheets.google.com/feeds/ list cells / / /public/values OK"]]