Method: spreadsheets.values.update
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Establece valores en un rango de una hoja de cálculo. El llamador debe especificar el ID, el rango y un valueInputOption
de la hoja de cálculo.
Solicitud HTTP
PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}
La URL usa la sintaxis de la transcodificación gRPC.
Parámetros de ruta de acceso
Parámetros |
spreadsheetId |
string
Es el ID de la hoja de cálculo que se actualizará.
|
range |
string
La notación A1 de los valores que se actualizarán.
|
Parámetros de consulta
Parámetros |
valueInputOption |
enum (ValueInputOption )
Indica cómo se deben interpretar los datos de entrada.
|
includeValuesInResponse |
boolean
Determina si la respuesta de actualización debe incluir los valores de las celdas que se actualizaron. De forma predeterminada, las respuestas no incluyen los valores actualizados. Si el rango que se escribió era mayor que el que se escribió, la respuesta incluye todos los valores del rango solicitado (sin incluir las filas y columnas vacías finales).
|
responseValueRenderOption |
enum (ValueRenderOption )
Determina cómo se deben renderizar los valores en la respuesta. La opción de renderización predeterminada es FORMATTED_VALUE .
|
responseDateTimeRenderOption |
enum (DateTimeRenderOption )
Determina cómo se deben renderizar las fechas, las horas y las duraciones en la respuesta. Se ignora si responseValueRenderOption es FORMATTED_VALUE . La opción de renderización de fecha y hora predeterminada es SERIAL_NUMBER .
|
Cuerpo de la solicitud
El cuerpo de la solicitud contiene una instancia de ValueRange
.
Cuerpo de la respuesta
Si se ejecuta de forma correcta, el cuerpo de la respuesta contiene una instancia de UpdateValuesResponse
.
Alcances de autorización
Se necesita uno de los siguientes permisos de OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/spreadsheets
Para obtener más información, consulta la Guía de autorización.
Salvo que se indique lo contrario, el contenido de esta página está sujeto a la licencia Atribución 4.0 de Creative Commons, y los ejemplos de código están sujetos a la licencia Apache 2.0. Para obtener más información, consulta las políticas del sitio de Google Developers. Java es una marca registrada de Oracle o sus afiliados.
Última actualización: 2025-03-22 (UTC)
[null,null,["Última actualización: 2025-03-22 (UTC)"],[],[],null,["# Method: spreadsheets.values.update\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\nSets values in a range of a spreadsheet. The caller must specify the spreadsheet ID, range, and a [valueInputOption](/workspace/sheets/api/reference/rest/v4/ValueInputOption).\n\n### HTTP request\n\n`PUT https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}`\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 the values to update. |\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| `includeValuesInResponse` | `boolean` Determines if the update response should include the values of the cells that were updated. By default, responses do not include the updated values. If the range to write was larger than the range actually written, the response includes all values in the requested range (excluding trailing empty rows and columns). |\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/update#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\nIf successful, the response body contains an instance of [UpdateValuesResponse](/workspace/sheets/api/reference/rest/v4/UpdateValuesResponse).\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)."]]