Method: spreadsheets.values.append
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Aggiunge valori a un foglio di lavoro. L'intervallo di input viene utilizzato per cercare i dati esistenti e trovare una "tabella" all'interno di questo intervallo. I valori verranno aggiunti alla riga successiva della tabella, a partire dalla prima colonna. Per informazioni dettagliate su come vengono rilevate le tabelle e vengono aggiunti i dati, consulta la guida e il codice di esempio.
L'utente che chiama deve specificare l'ID del foglio di lavoro, l'intervallo e un valueInputOption
. valueInputOption
controlla solo la modalità di aggiunta dei dati di input al foglio (per riga o per colonna), ma non influisce sulla cella in cui iniziano a essere scritti i dati.
Richiesta HTTP
POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}:append
L'URL utilizza la sintassi di transcodifica gRPC.
Parametri del percorso
Parametri |
spreadsheetId |
string
L'ID del foglio di lavoro da aggiornare.
|
range |
string
La notazione A1 di un intervallo in cui cercare una tabella logica di dati. I valori vengono aggiunti dopo l'ultima riga della tabella.
|
Parametri di query
Parametri |
valueInputOption |
enum (ValueInputOption )
Come devono essere interpretati i dati di input.
|
insertDataOption |
enum (InsertDataOption )
Come devono essere inseriti i dati di input.
|
includeValuesInResponse |
boolean
Determina se la risposta all'aggiornamento deve includere i valori delle celle aggiunte. Per impostazione predefinita, le risposte non includono i valori aggiornati.
|
responseValueRenderOption |
enum (ValueRenderOption )
Determina la modalità di visualizzazione dei valori nella risposta. L'opzione di rendering predefinita è FORMATTED_VALUE .
|
responseDateTimeRenderOption |
enum (DateTimeRenderOption )
Determina la modalità di visualizzazione di date, ore e durate nella risposta. Questo valore viene ignorato se responseValueRenderOption è FORMATTED_VALUE . L'opzione di visualizzazione predefinita per dateTime è SERIAL_NUMBER .
|
Corpo della richiesta
Il corpo della richiesta contiene un'istanza di ValueRange
.
Corpo della risposta
La risposta all'aggiornamento di un intervallo di valori in un foglio di lavoro.
In caso di esito positivo, il corpo della risposta contiene dati con la seguente struttura:
Rappresentazione JSON |
{
"spreadsheetId": string,
"tableRange": string,
"updates": {
object (UpdateValuesResponse )
}
} |
Campi |
spreadsheetId |
string
Il foglio di lavoro a cui sono stati applicati gli aggiornamenti.
|
tableRange |
string
L'intervallo (in notazione A1) della tabella a cui vengono aggiunti i valori (prima dell'aggiunta dei valori). Vuoto se non è stata trovata alcuna tabella.
|
updates |
object (UpdateValuesResponse )
Informazioni sugli aggiornamenti applicati.
|
Ambiti di autorizzazione
Richiede uno dei seguenti ambiti OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
Per ulteriori informazioni, consulta la Guida all'autorizzazione.
InsertDataOption
Determina in che modo i dati esistenti vengono modificati quando vengono inseriti nuovi dati.
Enum |
OVERWRITE |
I nuovi dati sovrascrivono i dati esistenti nelle aree in cui vengono scritti. Nota: l'aggiunta di dati alla fine del foglio inserirà comunque nuove righe o colonne in modo che i dati possano essere scritti. |
INSERT_ROWS |
Le righe vengono inserite per i nuovi dati. |
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-03-22 UTC.
[null,null,["Ultimo aggiornamento 2025-03-22 UTC."],[],[],null,["# Method: spreadsheets.values.append\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 - [JSON representation](#body.AppendValuesResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [InsertDataOption](#InsertDataOption)\n- [Try it!](#try-it)\n\nAppends values to a spreadsheet. The input range is used to search for existing data and find a \"table\" within that range. Values will be appended to the next row of the table, starting with the first column of the table. See the [guide](https://developers.google.com/workspace/sheets/api/guides/values#appending_values) and [sample code](https://developers.google.com/workspace/sheets/api/samples/writing#append_values) for specific details of how tables are detected and data is appended.\n\nThe caller must specify the spreadsheet ID, range, and a [valueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption). The `valueInputOption` only controls how the input data will be added to the sheet (column-wise or row-wise), it does not influence what cell the data starts being written to.\n\n### HTTP request\n\n`POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}:append`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `spreadsheetId` | `string` The ID of the spreadsheet to update. |\n| `range` | `string` The [A1 notation](https://developers.google.com/workspace/sheets/api/guides/concepts#cell) of a range to search for a logical table of data. Values are appended after the last row of the table. |\n\n### Query parameters\n\n| Parameters ||\n|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `valueInputOption` | `enum (`[ValueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption)`)` How the input data should be interpreted. |\n| `insertDataOption` | `enum (`[InsertDataOption](/workspace/sheets/api/reference/rest/v4/spreadsheets.values/append#InsertDataOption)`)` How the input data should be inserted. |\n| `includeValuesInResponse` | `boolean` Determines if the update response should include the values of the cells that were appended. By default, responses do not include the updated values. |\n| `responseValueRenderOption` | `enum (`[ValueRenderOption](/workspace/sheets/api/reference/rest/v4/ValueRenderOption)`)` Determines how values in the response should be rendered. The default render option is [FORMATTED_VALUE](/workspace/sheets/api/reference/rest/v4/ValueRenderOption). |\n| `responseDateTimeRenderOption` | `enum (`[DateTimeRenderOption](/workspace/sheets/api/reference/rest/v4/DateTimeRenderOption)`)` Determines how dates, times, and durations in the response should be rendered. This is ignored if [responseValueRenderOption](/workspace/sheets/api/reference/rest/v4/spreadsheets.values/append#body.QUERY_PARAMETERS.response_value_render_option) is [FORMATTED_VALUE](/workspace/sheets/api/reference/rest/v4/ValueRenderOption). The default dateTime render option is [SERIAL_NUMBER](/workspace/sheets/api/reference/rest/v4/DateTimeRenderOption). |\n\n### Request body\n\nThe request body contains an instance of [ValueRange](/workspace/sheets/api/reference/rest/v4/spreadsheets.values#ValueRange).\n\n### Response body\n\nThe response when updating a range of values in a spreadsheet.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"spreadsheetId\": string, \"tableRange\": string, \"updates\": { object (/workspace/sheets/api/reference/rest/v4/UpdateValuesResponse) } } ``` |\n\n| Fields ||\n|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `spreadsheetId` | `string` The spreadsheet the updates were applied to. |\n| `tableRange` | `string` The range (in A1 notation) of the table that values are being appended to (before the values were appended). Empty if no table was found. |\n| `updates` | `object (`[UpdateValuesResponse](/workspace/sheets/api/reference/rest/v4/UpdateValuesResponse)`)` Information about the updates that were applied. |\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.file`\n- `https://www.googleapis.com/auth/spreadsheets`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nInsertDataOption\n----------------\n\nDetermines how existing data is changed when new data is input.\n\n| Enums ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `OVERWRITE` | The new data overwrites existing data in the areas it is written. (Note: adding data to the end of the sheet will still insert new rows or columns so the data can be written.) |\n| `INSERT_ROWS` | Rows are inserted for the new data. |"]]