Re-runs every filter on the table with its current criteria.
Optionaloptions: ITransaction.OperationOptionsClears this column's condition. The other columns' filters stay.
Optionaloptions: ITransaction.OperationOptionsFilter the range using a condition.
Optionalcondition: Input<any>Optionaloptions: ITransaction.OperationOptionsResolves once the rows are hidden.
Examples:
keep only values greater than or equal to 30:
sheet.getRange('E:E').filter({
operator: ICondition.BuiltInOperatorNames.GreaterThanOrEqual,
param: 30
});
Example 2 – function param
sheet.getRange('E:E').filter(value => value >= 30);
// or with context: (e.g., to ignore header row)
sheet.getRange('E:E').filter((value, ctx) => {
const { rowIndex } = ctx.getCoords();
return rowIndex > 1 && value >= 30;
});
Example 3 – string
The expression is parsed using the same rules as user input
(e.g., "30" is a number, "=A1*2" is a formula, "40%" is 0.4).
sheet.getRange('E:E').filter('>= 30');
Return the condition, or null if none is set.
The texts values show as in this column's data rows, each once, in column order: what a
list by displayed text would hold for them, and what the xlsx writer spells a value list as,
since OOXML's list holds displayed text. A value no cell holds contributes nothing.
The column's distinct values, as a filter menu lists them.
Optionaloptions: IFilter.GetItemsOptions
Which rows are read depends on the column:
An item is checked when at least one row holding it passes the filters, so a column filtered
by any condition (> 5, say) lists the passing values checked. A row hidden by hand does not
uncheck its value.
Reads the stored values in one pass; the cost follows the column's content, not its extent.
Returns the range this filter applies to: the column's data rows, header and totals excluded.
A filter is exactly one column of its table, which is why the singular is declared here rather than on ICondition.Stateful.
Set the condition, null to clear this column's.
The condition, or null to clear.
Optionalreplace: boolean
If true, every other column's filter is dropped; omitted, they stay and this
one ANDs with them. A column already filtered keeps its place in the level order.
Optionaloptions: ITransaction.OperationOptions
Transaction options.
Resolves once the rows are hidden; one transaction, one undo step.
Filters are used to hide spans (rows or columns). that do not match a set of conditions.
Remarks
A column's filter ANDs with the other columns' (Excel's AutoFilter): setting one leaves the rest in place unless
replacesays otherwise. Every write returns a Promise that resolves once the rows are hidden; the criteria are written in the same transaction, so anawaitis what makes a read after the call see them.