Method: spreadsheets.get
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Restituisce il foglio di lavoro con l'ID specificato. L'utente che chiama deve specificare l'ID del foglio di lavoro.
Per impostazione predefinita, i dati all'interno delle griglie non vengono restituiti. Puoi includere i dati della griglia in due modi:
Specifica una maschera di campo che elenca i campi che ti interessano utilizzando il parametro URL fields
in HTTP
Imposta il parametro URL includeGridData
su true. Se è impostata una maschera di campo, il parametro includeGridData
viene ignorato
Per i fogli di lavoro di grandi dimensioni, come best practice, recupera solo i campi specifici che ti interessano.
Per recuperare solo sottoinsiemi di dati del foglio di lavoro, utilizza il parametro URL ranges
. Gli intervalli vengono specificati utilizzando la notazione A1. Puoi definire una singola cella (ad esempio A1
) o più celle (ad esempio A1:D5
). Puoi anche recuperare celle da altri fogli dello stesso foglio di lavoro (ad esempio Sheet2!A1:C4
) o recuperare più intervalli contemporaneamente (ad esempio ?ranges=A1:D5&ranges=Sheet2!A1:C4
). Se limiti l'intervallo, vengono restituite solo le parti del foglio di lavoro che intersecano gli intervalli richiesti.
Richiesta HTTP
GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}
L'URL utilizza la sintassi di transcodifica gRPC.
Parametri del percorso
Parametri |
spreadsheetId |
string
Il foglio di lavoro da richiedere.
|
Parametri di query
Parametri |
ranges[] |
string
Gli intervalli da recuperare dal foglio di lavoro.
|
includeGridData |
boolean
True se devono essere restituiti i dati della griglia. Questo parametro viene ignorato se nella richiesta è stata impostata una maschera di campo.
|
excludeTablesInBandedRanges |
boolean
True se le tabelle devono essere escluse dagli intervalli con bande. False se non impostato.
|
Corpo della richiesta
Il corpo della richiesta deve essere vuoto.
Corpo della risposta
In caso di esito positivo, il corpo della risposta contiene un'istanza di Spreadsheet
.
Ambiti di autorizzazione
Richiede uno dei seguenti ambiti OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
https://www.googleapis.com/auth/spreadsheets.readonly
Per ulteriori informazioni, consulta la Guida all'autorizzazione.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-04-30 UTC.
[null,null,["Ultimo aggiornamento 2025-04-30 UTC."],[],[],null,["# Method: spreadsheets.get\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nReturns the spreadsheet at the given ID. The caller must specify the spreadsheet ID.\n\nBy default, data within grids is not returned. You can include grid data in one of 2 ways:\n\n- Specify a [field mask](https://developers.google.com/workspace/sheets/api/guides/field-masks) listing your desired fields using the `fields` URL parameter in HTTP\n\n- Set the [includeGridData](/workspace/sheets/api/reference/rest/v4/spreadsheets/get#body.QUERY_PARAMETERS.include_grid_data) URL parameter to true. If a field mask is set, the `includeGridData` parameter is ignored\n\nFor large spreadsheets, as a best practice, retrieve only the specific spreadsheet fields that you want.\n\nTo retrieve only subsets of spreadsheet data, use the [ranges](/workspace/sheets/api/reference/rest/v4/spreadsheets/get#body.QUERY_PARAMETERS.ranges) URL parameter. Ranges are specified using [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell). You can define a single cell (for example, `A1`) or multiple cells (for example, `A1:D5`). You can also get cells from other sheets within the same spreadsheet (for example, `Sheet2!A1:C4`) or retrieve multiple ranges at once (for example, `?ranges=A1:D5&ranges=Sheet2!A1:C4`). Limiting the range returns only the portions of the spreadsheet that intersect the requested ranges.\n\n### HTTP request\n\n`GET https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------------|--------------------------------------|\n| `spreadsheetId` | `string` The spreadsheet to request. |\n\n### Query parameters\n\n| Parameters ||\n|-------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| `ranges[]` | `string` The ranges to retrieve from the spreadsheet. |\n| `includeGridData` | `boolean` True if grid data should be returned. This parameter is ignored if a field mask was set in the request. |\n| `excludeTablesInBandedRanges` | `boolean` True if tables should be excluded in the banded ranges. False if not set. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [Spreadsheet](/workspace/sheets/api/reference/rest/v4/spreadsheets#Spreadsheet).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `https://www.googleapis.com/auth/drive.readonly`\n- `https://www.googleapis.com/auth/drive.file`\n- `https://www.googleapis.com/auth/spreadsheets`\n- `https://www.googleapis.com/auth/spreadsheets.readonly`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]