- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- Request
- UpdateSpreadsheetPropertiesRequest
- UpdateSheetPropertiesRequest
- UpdateDimensionPropertiesRequest
- DataSourceSheetDimensionRange
- UpdateNamedRangeRequest
- RepeatCellRequest
- AddNamedRangeRequest
- DeleteNamedRangeRequest
- AddSheetRequest
- DeleteSheetRequest
- AutoFillRequest
- SourceAndDestination
- CutPasteRequest
- PasteType
- CopyPasteRequest
- PasteOrientation
- MergeCellsRequest
- MergeType
- UnmergeCellsRequest
- UpdateBordersRequest
- UpdateCellsRequest
- AddFilterViewRequest
- AppendCellsRequest
- ClearBasicFilterRequest
- DeleteDimensionRequest
- DeleteEmbeddedObjectRequest
- DeleteFilterViewRequest
- DuplicateFilterViewRequest
- DuplicateSheetRequest
- FindReplaceRequest
- InsertDimensionRequest
- InsertRangeRequest
- MoveDimensionRequest
- UpdateEmbeddedObjectPositionRequest
- PasteDataRequest
- TextToColumnsRequest
- DelimiterType
- UpdateFilterViewRequest
- DeleteRangeRequest
- AppendDimensionRequest
- AddConditionalFormatRuleRequest
- UpdateConditionalFormatRuleRequest
- DeleteConditionalFormatRuleRequest
- SortRangeRequest
- SetDataValidationRequest
- SetBasicFilterRequest
- AddProtectedRangeRequest
- UpdateProtectedRangeRequest
- DeleteProtectedRangeRequest
- AutoResizeDimensionsRequest
- AddChartRequest
- UpdateChartSpecRequest
- UpdateBandingRequest
- AddBandingRequest
- DeleteBandingRequest
- CreateDeveloperMetadataRequest
- UpdateDeveloperMetadataRequest
- DeleteDeveloperMetadataRequest
- RandomizeRangeRequest
- AddDimensionGroupRequest
- DeleteDimensionGroupRequest
- UpdateDimensionGroupRequest
- TrimWhitespaceRequest
- DeleteDuplicatesRequest
- UpdateEmbeddedObjectBorderRequest
- AddSlicerRequest
- UpdateSlicerSpecRequest
- AddDataSourceRequest
- UpdateDataSourceRequest
- DeleteDataSourceRequest
- RefreshDataSourceRequest
- DataSourceObjectReferences
- DataSourceObjectReference
- CancelDataSourceRefreshRequest
- AddTableRequest
- UpdateTableRequest
- DeleteTableRequest
- InsertCommentRequest
- AddCommentReplyRequest
- UpdateCommentPostRequest
- DeleteCommentRequest
- DeleteCommentReplyRequest
- Response
- AddNamedRangeResponse
- AddSheetResponse
- AddFilterViewResponse
- DuplicateFilterViewResponse
- DuplicateSheetResponse
- FindReplaceResponse
- UpdateEmbeddedObjectPositionResponse
- UpdateConditionalFormatRuleResponse
- DeleteConditionalFormatRuleResponse
- AddProtectedRangeResponse
- AddChartResponse
- AddBandingResponse
- CreateDeveloperMetadataResponse
- UpdateDeveloperMetadataResponse
- DeleteDeveloperMetadataResponse
- AddDimensionGroupResponse
- DeleteDimensionGroupResponse
- TrimWhitespaceResponse
- DeleteDuplicatesResponse
- AddSlicerResponse
- AddDataSourceResponse
- UpdateDataSourceResponse
- RefreshDataSourceResponse
- RefreshDataSourceObjectExecutionStatus
- CancelDataSourceRefreshResponse
- CancelDataSourceRefreshStatus
- RefreshCancellationStatus
- RefreshCancellationState
- RefreshCancellationErrorCode
- AddTableResponse
- InsertCommentResponse
- AddCommentReplyResponse
- CommentUpdateState
- Try it!
Applies one or more updates to the spreadsheet.
Each request is validated before being applied. If any request is not valid then the entire request will fail and nothing will be applied.
Some requests have replies to give you some information about how they are applied. The replies will mirror the requests. For example, if you applied 4 updates and the 3rd one had a reply, then the response will have 2 empty replies, the actual reply, and another empty reply, in that order.
Due to the collaborative nature of spreadsheets, it is not guaranteed that the spreadsheet will reflect exactly your changes after this completes, however it is guaranteed that the updates in the request will be applied together atomically. Your changes may be altered with respect to collaborator changes. If there are no collaborators, the spreadsheet should reflect your changes.
HTTP request
POST https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}:batchUpdate
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
spreadsheetId |
The spreadsheet to apply the updates to. |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "requests": [ { object ( |
| Fields | |
|---|---|
requests[] |
A list of updates to apply to the spreadsheet. Requests will be applied in the order they are specified. If any request is not valid, no requests will be applied. |
includeSpreadsheetInResponse |
Determines if the update response should include the spreadsheet resource. |
responseRanges[] |
Limits the ranges included in the response spreadsheet. Meaningful only if |
responseIncludeGridData |
True if grid data should be returned. Meaningful only if |
commentsViewMode |
The comments view mode to apply to the spreadsheet. This allows viewing the spreadsheet with comments omitted or included. If one is not specified, |
Response body
The reply for batch updating a spreadsheet.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "spreadsheetId": string, "replies": [ { object ( |
| Fields | |
|---|---|
spreadsheetId |
The spreadsheet the updates were applied to. |
replies[] |
The reply of the updates. This maps 1:1 with the updates, although replies to some requests may be empty. |
updatedSpreadsheet |
The spreadsheet after updates were applied. This is only set if |
commentUpdateState |
Whether comment updates were applied in the batch request. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/spreadsheets
For more information, see the Authorization guide.
CommentUpdateState
The status of comment updates in the batch request.
| Enums | |
|---|---|
COMMENT_UPDATE_STATE_UNSPECIFIED |
The status of comment updates is unspecified. |
NO_UPDATES_REQUESTED |
No comment updates were requested in the batch request. |
ALL_SAVED |
All requested comment updates were applied in the batch request. |
ALL_FAILED_UNKNOWN_REASON |
All requested comment updates failed. |