Description
Overwrites all data in a region with new data. If the provided range data is smaller than the specified region, all cells in the region and not covered by the range data will be cleared. The provided range data must not be larger than the specified region. An empty range data is valid and may be used to clear a region.
If a very large payload is supplied, or changes to the updated region trigger complex formula recalculations, the operation may result in an error. If this is encountered frequently, consider using the corresponding Asynchronous update endpoint to asynchronously write data to a region instead.
PUT
/spreadsheets/{SpreadsheetId}/sheets/{SheetId}/data/{Region}
Required OAuth Scopes:
data_tables|w
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
SpreadsheetId | path | string | true | A unique identifier for a spreadsheet |
SheetId | path | string | true | A unique identifier for a sheet within a spreadsheet |
Region | path | string | true | A1 style representation of a cell or range. A range may be unbounded in any/all directions by leaving off the corresponding column or row. Unbounded ranges will be clamped to the data in the queried region. |
body | body | RangeDataBody | true | Multidimensional array of cell values in row-major order. The null JSON value may be used to avoid modifying a cell. |
Detailed descriptions
Region: A1 style representation of a cell or range. A range may be unbounded in any/all directions by leaving off the corresponding column or row. Unbounded ranges will be clamped to the data in the queried region.
Cell Syntax: [Column][Row]
Range Syntax: [Start Column][Start Row]:[Stop Column][Stop Row]
Examples:
- The region
A1
selects data in the cellA1
- The region
A2:D8
selects all data in the range betweenA2
andD8
(inclusive) - The region
A:A
selects all data in columnA
- The region
1:3
selects all data in rows1
through3
- The region
B3:
selects all data below and to the right ofB3
(inclusive) - The region
:
selects all data in the sheet
Be sure to URL encode the region to avoid misinterpretation of the :
.
Body parameter example
{
"values": [
[
"Row1-Column1 Data",
"Row1-Column2 Data"
],
[
"Row2-Column1 Data",
"Row2-Column2 Data"
]
]
}
Code Samples
curl -X PUT https://api.app.wdesk.com/spreadsheets/v1/spreadsheets/{SpreadsheetId}/sheets/{SheetId}/data/{Region} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'
http PUT https://api.app.wdesk.com/spreadsheets/v1/spreadsheets/{SpreadsheetId}/sheets/{SheetId}/data/{Region} \
Content-Type:application/json \
Accept:application/json \
Authorization:"Bearer {access-token}"
wget --method=PUT "https://api.app.wdesk.com/spreadsheets/v1/spreadsheets/{SpreadsheetId}/sheets/{SheetId}/data/{Region}" \
--output-document - \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {access-token}'
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put('https://api.app.wdesk.com/spreadsheets/v1/spreadsheets/{SpreadsheetId}/sheets/{SheetId}/data/{Region}', headers = headers)
print(r.json())
Returns
200 - OK
No content returned.
Example Responses
{
"message": "Operation successful",
"request_id": "d6a6ce3f-f120-4104-9587-a5a2dc45626c"
}