Skip to main content

deleteMany()

Used to delete all rows matching the specified conditions.

Available Keys

KeyDescriptionOptionalNotes
whereSpecifies deletion conditionsOptionalTargets all rows if omitted
limitMaximum number of records to deleteOptionalNegative values cause an error

Example Sheet

Example Sheet

Description

Suppose you want to perform the following operation on the above example:

  • age => Delete rows with value 20

The code would be:

const gassma = new Gassma.GassmaClient();

// gassma.{{TARGET_SHEET_NAME}}.deleteMany
const result = gassma.sheet1.deleteMany({
where: {
age: 20,
},
});

The return value has the following format:

{
count: 1;
}

The number of deleted rows is returned.

limit

You can specify the maximum number of records to delete:

// Delete at most 3 records
const result = gassma.sheet1.deleteMany({
where: {
pref: "Tokyo",
},
limit: 3,
});

Specifying limit: 0 results in 0 deletions (nothing is deleted).

caution

Specifying a negative value for limit throws GassmaLimitNegativeError.

The where specification follows findMany().