updateMany()
Updates all rows matching the specified conditions to the given values.
Available Keys
| Key | Description | Optional | Notes |
|---|---|---|---|
| where | Specifies update conditions | Optional | Targets all rows if omitted |
| data | Data to update | Required | |
| limit | Maximum number of records to update | Optional | Negative values cause an error |
data is required. Omitting it throws GassmaMissingArgumentError (message: Argument data is missing.). where is optional; if omitted, all rows are targeted. The same applies to where: {} and to a where that became empty because its conditions were all undefined.
Fields whose data value is undefined are treated as "not specified" and are not updated.
Example Sheet

Description
Suppose you want to perform the following operation on the above example:
- age => Change 20 to 21
The code would be:
const gassma = new Gassma.GassmaClient();
// gassma.{{TARGET_SHEET_NAME}}.updateMany
const result = gassma.sheet1.updateMany({
where: {
age: 20,
},
data: {
age: 21,
},
});
The return value has the following format:
{
count: 1;
}
The number of updated rows is returned.
The where specification follows findMany().
limit
You can specify the maximum number of records to update:
// Update at most 2 records
const result = gassma.sheet1.updateMany({
where: {
pref: "Tokyo",
},
data: {
age: 99,
},
limit: 2,
});
Specifying limit: 0 results in 0 updates (nothing is updated).
Specifying a finite negative value for limit throws GassmaLimitNegativeError.
NaN / Infinity / -Infinity / null throw GassmaInvalidValueError instead. In that case no rows are updated at all.
gassma.sheet1.updateMany({ data: { age: 1 }, limit: NaN });
// => Invalid value for argument `limit`. Expected a finite number, but received NaN.
gassma.sheet1.updateMany({ data: { age: 1 }, limit: null });
// => Invalid value for argument `limit`. Expected a number, but received null.
limit: -Infinity used to throw GassmaLimitNegativeError, but the finiteness check now runs first, so it throws GassmaInvalidValueError. undefined is still ignored (no upper bound).
Atomic Number Operations
By specifying increment / decrement / multiply / divide in data, you can perform operations on the current value:
// Increment everyone's age by 1
const result = gassma.sheet1.updateMany({
data: {
age: { increment: 1 },
},
});
| Operation | Behavior | Example |
|---|---|---|
| increment | Addition | { increment: 5 } → current value + 5 |
| decrement | Subtraction | { decrement: 3 } → current value - 3 |
| multiply | Multiplication | { multiply: 2 } → current value × 2 |
| divide | Division | { divide: 4 } → current value ÷ 4 |
If the current value is not a number, 0 is used as the base for calculations. For details, see update().