Visão geral da API Google Sheets
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
A API Google Sheets é uma interface RESTful que permite ler e modificar os dados de uma planilha. Com a API Sheets, você pode:
- Criar planilhas
- Ler e gravar valores de células da planilha
- Atualizar a formatação da planilha
- Gerenciar as páginas conectadas
Confira uma lista de termos comuns usados na API Google Sheets:
- Planilha
O objeto principal no Planilhas Google. Ele pode conter vários Sheets
, cada um com informações estruturadas contidas em Cells
. O recurso
spreadsheets
representa uma planilha. Ele contém um valor spreadsheetId
exclusivo.
- ID da planilha
- O identificador exclusivo de uma planilha. É uma string específica
que contém letras, números e alguns caracteres especiais que fazem referência a uma
planilha, e pode ser derivada do URL dela. Os IDs das planilhas são estáveis, mesmo que o nome da planilha mude.
https://docs.google.com/spreadsheets/d/SPREADSHEET_ID/edit?gid=SHEET_ID#gid=SHEET_ID
- Página
Uma página ou guia em uma planilha. O recurso
Sheets
representa uma página. Ele contém um valor numérico sheetId
exclusivo e title
da planilha como parte do objeto SheetProperties
.
- ID da planilha
- O identificador exclusivo de uma planilha específica. É um número inteiro específico que contém números que fazem referência a uma planilha e pode ser derivado do URL dela. Os IDs das planilhas são estáveis, mesmo que o nome da planilha mude. Por exemplo, consulte ID da planilha.
- Cell
Um campo individual de texto ou dados em uma planilha. As células são organizadas em linhas e colunas e podem ser agrupadas como um intervalo de células. O recurso
Cells
representa cada célula, mas não tem um valor de ID exclusivo.
Em vez disso, as coordenadas de linha e coluna identificam as células.
- Notação A1
- Uma sintaxe usada para definir uma célula ou um intervalo de células com uma string que contém o nome da planilha mais as coordenadas de célula inicial e final usando letras de coluna e números de linha. Esse método é o mais comum e útil
ao referenciar um intervalo absoluto de células.
Sheet1!A1:B2
se refere a todas as células nas duas primeiras linhas e colunas da Sheet1.
Sheet1!A:A
se refere a todas as células na primeira coluna da Sheet1.
Sheet1!1:2
se refere a todas as células nas duas primeiras linhas da Sheet1.
Sheet1!A5:A
se refere a todas as células da primeira coluna da Sheet1, da linha 5 em diante.
A1:B2
se refere a todas as células nas duas primeiras linhas e colunas da primeira página visível.
Sheet1
se refere a todas as células na Sheet1.
'Jon's_Data'!A1:D5
se refere a todas as células nas cinco primeiras linhas e quatro colunas de uma planilha chamada "Jon's_Data".
'My Custom Sheet'!A:A
se refere a todas as células da primeira coluna de uma planilha chamada "Minha planilha personalizada".
'My Custom Sheet'
se refere a todas as células em "Minha planilha personalizada".
As aspas simples são obrigatórias para nomes de planilhas com espaços ou caracteres especiais.
Dica: sempre que possível, use nomes diferentes para objetos nas suas planilhas. Por exemplo, A1 (sem aspas) se refere à célula A1 na primeira planilha visível. 'A1'
se refere a uma página com o nome A1. Da mesma forma, "Página1" se refere a uma planilha com o nome "Página1". No entanto, se houver um intervalo nomeado chamado "Planilha1", "Planilha1" se referirá ao intervalo nomeado e 'Sheet1'
à planilha.
- Notação R1C1
- Uma sintaxe usada para definir uma célula ou um intervalo de células com uma string que contém o nome da planilha mais as coordenadas das células inicial e final usando números de linha e coluna. Esse método é menos comum do que a notação A1, mas pode ser útil ao referenciar um intervalo de células em relação à posição de uma célula específica.
Sheet1!R1C1:R2C2
se refere às duas primeiras células nas duas primeiras linhas da Sheet1.
R1C1:R2C2
se refere às duas primeiras células nas duas primeiras linhas da primeira planilha visível.
Sheet1!R[3]C[1]
se refere à célula que está três linhas abaixo e uma coluna à direita da célula atual.
- Intervalo nomeado
- Uma célula ou um intervalo de células definido com um nome personalizado para simplificar as referências em um aplicativo. Um recurso
FilterView
representa um intervalo nomeado.
- Intervalo protegido
- Uma célula ou um intervalo de células definidos que não podem ser modificados. Um recurso
ProtectedRange
representa um intervalo protegido.
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 2025-08-29 UTC.
[null,null,["Última atualização 2025-08-29 UTC."],[],[],null,["# Google Sheets API Overview\n\nThe Google Sheets API is a RESTful interface that lets you read and modify a\nspreadsheet's data. The Sheets API lets you:\n\n- Create spreadsheets\n- Read and write spreadsheet cell values\n- Update spreadsheet formatting\n- Manage Connected Sheets\n\nThe following is a list of common terms used in the Sheets API:\n\n*Spreadsheet*\n\n: The primary object in Google Sheets. It can contain multiple `Sheets`, each\n with structured information contained in `Cells`. The\n [`spreadsheets`](/workspace/sheets/api/reference/rest/v4/spreadsheets)\n resource represents a spreadsheet. It contains a unique `spreadsheetId`\n value.\n\n *Spreadsheet ID*\n : The unique identifier for a spreadsheet. It's a particular string\n containing letters, numbers, and some special characters that reference a\n spreadsheet and it can be derived from the spreadsheet's URL. Spreadsheet\n IDs are stable, even if the spreadsheet name changes. \n\n https://docs.google.com/spreadsheets/d/\u003cvar translate=\"no\"\u003eSPREADSHEET_ID\u003c/var\u003e/edit?gid=\u003cvar translate=\"no\"\u003eSHEET_ID\u003c/var\u003e#gid=\u003cvar translate=\"no\"\u003eSHEET_ID\u003c/var\u003e\n\n*Sheet*\n\n: A page or tab within a spreadsheet. The\n [`Sheets`](/workspace/sheets/api/reference/rest/v4/spreadsheets/sheets) resource\n represents a sheet. It contains a unique numeric `sheetId` value and sheet\n `title` as part of the\n [`SheetProperties`](/workspace/sheets/api/reference/rest/v4/spreadsheets/sheets#sheetproperties)\n object.\n\n *Sheet ID*\n : The unique identifier for a specific sheet within a spreadsheet. It's a\n particular integer containing numbers that reference a sheet and it can be\n derived from the spreadsheet's URL. Sheet IDs are stable, even if the sheet\n name changes. For an example, see [Spreadsheet ID](#spreadsheet-id).\n\n*Cell*\n\n: An individual field of text or data within a sheet. Cells are arranged in rows\n and columns, and can be grouped as a range of cells. The\n [`Cells`](/workspace/sheets/api/reference/rest/v4/spreadsheets/cells)\n resource represents each cell, but it doesn't have a unique ID value.\n Instead, row and column coordinates identify the cells.\n\n *A1 notation*\n : A syntax used to define a cell or range of cells with a string that\n contains the sheet name plus the starting and ending cell coordinates using\n column letters and row numbers. This method is the most common and useful\n when referencing an absolute range of cells.\n - `Sheet1!A1:B2` refers to all the cells in the first two rows and columns of Sheet1.\n - `Sheet1!A:A` refers to all the cells in the first column of Sheet1.\n - `Sheet1!1:2` refers to all the cells in the first two rows of Sheet1.\n - `Sheet1!A5:A` refers to all the cells of the first column of Sheet 1, from row 5 onward.\n - `A1:B2` refers to all the cells in the first two rows and columns of the first visible sheet.\n - `Sheet1` refers to all the cells in Sheet1.\n - `'Jon's_Data'!A1:D5` refers to all the cells in the first five rows and four columns of a sheet named \"Jon's_Data.\"\n - `'My Custom Sheet'!A:A` refers to all the cells in the first column of a sheet named \"My Custom Sheet.\"\n - `'My Custom Sheet'` refers to all the cells in \"My Custom Sheet\".\n\n Single quotes are required for sheet names with spaces or special characters.\n\n **Tip** : Where possible, use distinct names for objects in your spreadsheets. For example, A1 (without quotes) refers to cell A1 in the first visible sheet. `'A1'` refers to a sheet with the name A1. Similarly, Sheet1 refers to a sheet with the name Sheet1. However, if there's a named range titled \"Sheet1\", then Sheet1 refers to the named range and `'Sheet1'` refers to the sheet.\n\n *R1C1 notation*\n : A syntax used to define a cell or range of cells with a string that\n contains the sheet name plus the starting and ending cell coordinates using\n row numbers and column numbers. This method is less common than A1 notation,\n but can be useful when referencing a range of cells relative to a given\n cell's position.\n - `Sheet1!R1C1:R2C2` refers to the first two cells in the top two rows of Sheet1.\n - `R1C1:R2C2` refers to the first two cells in the top two rows of the first visible sheet.\n - `Sheet1!R[3]C[1]` refers to the cell that is three rows below and one column to the right of the current cell.\n\n *Named range*\n : A defined cell or range of cells with a custom name to simplify references\n throughout an application. A\n [`FilterView`](/workspace/sheets/api/reference/rest/v4/spreadsheets/sheets#filterview)\n resource represents a named range.\n\n *Protected range*\n : A defined cell or range of cells that cannot be modified. A\n [`ProtectedRange`](/workspace/sheets/api/reference/rest/v4/spreadsheets/sheets#protectedrange)\n resource represents a protected range.\n\nRelated topics\n--------------\n\n- To learn about developing with Google Workspace APIs, including handling\n authentication and authorization, refer to [Develop on\n Google Workspace](/workspace/guides/get-started).\n\n- To learn how to configure and run a Sheets API app, try the\n [JavaScript quickstart](/workspace/sheets/api/quickstart/js)."]]