Sheets Data API から JSON フィードを取得する簡単な例
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
警告: このページは、Google の古い API である Google Data API を対象としています。Google Data API ディレクトリに記載されている API のみを対象としており、その多くは新しい API に置き換えられています。特定の新しい API については、その新しい API のドキュメントをご覧ください。新しい API を使用してリクエストを承認する方法については、Google アカウントの認証と承認をご覧ください。
はじめに
このサンプルは、スプレッドシート データ API が提供する JSON 出力形式を使用して、スプレッドシートの特定のワークシートのリストまたはセルフィードを表示する方法を示します。これにより、スプレッドシートの公開リストやセルフィードに対してクエリを実行し、返されたエントリを JSON オブジェクトとして返すことができます。新しい JSON フィードを使用するには、src
値が
http://spreadsheets.google.com/feeds/feed/key/worksheet/public/basic?alt=json-in-script&callback=myFunc
ここで、feed
はフィードの種類、key
は取得するスプレッドシートのキー、worksheet
はワークシートの位置 ID または一意 ID、myFunc
は JSON オブジェクトを渡すコールバック関数の名前です。Google Data API の JSON 出力のサポートについて詳しくは、JSON 出力のサポート ドキュメントをご覧ください。
注: 認証されていないフィードを取得する機能は、公開されているスプレッドシートでのみサポートされています。
注: その他のフィードタイプ、可視性および投影値は、JSON 出力サポートで使用できます。その他のフィードタイプ、可視性、投影値について詳しくは、Google スプレッドシートの Data API に関するドキュメントをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2023-03-01 UTC。
[null,null,["最終更新日 2023-03-01 UTC。"],[],[],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"]]