Exemplo simples de recuperação de feeds JSON da API de dados das Planilhas
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Aviso: esta página é sobre as APIs mais antigas do Google, as APIs de dados do Google. Relevante apenas para as APIs listadas no diretório das APIs de dados do Google, muitas delas foram substituídas por APIs mais recentes. Para mais informações sobre uma nova API específica, consulte a documentação da nova API. Para informações sobre autorização de solicitações com uma API mais recente, consulte Autenticação e autorização de Contas do Google.
Introdução
Este exemplo mostra a exibição de um feed de lista ou células de uma planilha específica usando o formato de saída JSON fornecido pela API de dados das Planilhas. Isso permite que você consulte a lista pública ou o feed de células de uma planilha para receber as entradas resultantes retornadas como objetos JSON. Para usar o novo feed JSON, crie um elemento de script que tenha o valor src
definido como
http://spreadsheets.google.com/feeds/feed/key/worksheet/public/basic?alt=json-in-script&callback=myFunc
em que feed
é o tipo de feed, key
é a chave da planilha que você quer recuperar, worksheet
é o identificador posicional ou exclusivo da planilha e myFunc
é o nome da função de callback que recebe o objeto JSON. Para mais informações sobre o suporte à saída JSON para as APIs de dados do Google, consulte nossa documentação de suporte de saída JSON.
Observação: só é possível recuperar feeds sem autenticação em planilhas publicadas.
Observação: outros tipos de feed e valores de projeção e visibilidade podem ser usados com suporte à saída JSON. Para mais informações sobre outros tipos de feed e valores de visibilidade e projeção, consulte a documentação da API de dados de planilhas.
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2023-03-01 UTC.
[null,null,["Última atualização 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"]]