Stay organized with collections Save and categorize content based on your preferences.
Aside from the value data contained in its cells, a spreadsheet includes many other types of data, such as:
These are some of the many kinds of data that control the appearance and operation of a spreadsheet. The spreadsheets.batchUpdate
method lets you update any of these spreadsheet details. Changes are grouped in a batch so that if one request is unsuccessful, none of the other (potentially dependent) changes are written.
This page describes the basics of using the spreadsheets.batchUpdate
method. If you need to read and write cell value data, you can also use the spreadsheets.values
resource described in Read & write cell values.
The particular operations supported by spreadsheets.batchUpdate
can be grouped into the following broad categories:
These categories are used in the next section to describe the behavior of specific operations.
Batch update operationsThe spreadsheets.batchUpdate
method works by taking one or more Request objects, each one specifying a single kind of request to perform. There are many different kinds of requests. Here's a breakdown on the types of requests, grouped into different categories.
There are also some additional requests that mimic user actions for manipulating data:
To learn more about cell and row limits in Google Sheets, see Files you can store in Google Drive.
Field masksMany of the "update" requests require field masks. These are a comma-delimited list of fields to update only certain fields in an object while leaving the other fields unchanged. A field mask of *
is treated like a wildcard and is shorthand for specifying every field in a message (which means a field may revert to its default state if you don't specify a value for it in the request). For more information about field masks, see Use field masks.
The following sample uses the UpdateSpreadsheetPropertiesRequest
to update only the title of a spreadsheet:
Request:
POST .../v4/spreadsheets/spreadsheetId:batchUpdate
Request body:
{
"requests": [{
"updateSpreadsheetProperties": {
"properties": {"title": "TITLE"},
"fields": "title"
}
}]
}
Replace TITLE with the new title of the spreadsheet.
ResponsesWhen updating a spreadsheet, some kinds of requests might return responses. These are returned in an array, with each response occupying the same index as the corresponding request. Some requests don't have responses and for those the response is empty.
Typically, "add" requests have responses that return information such as the ID of the added object. For the list of supported responses, see Responses.
ExampleThe following code sample performs these actions:
title
variable.find
and replacement
variables.Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-04 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4