ExcelScript.PivotLabelFilter interface

Configurable template for a label filter to apply to a PivotField. The condition defines what criteria need to be set in order for the filter to operate.

Remarks

Examples

/**
 * This script filters items that start with "L" from the "Type" field
 * of the "Farm Sales" PivotTable.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the PivotTable.
  const pivotTable = workbook.getActiveWorksheet().getPivotTable("Farm Sales");

  // Get the "Type" field.
  const field = pivotTable.getHierarchy("Type").getPivotField("Type");

  // Filter out any types that start with "L" (such as "Lemons" and "Limes").
  const filter: ExcelScript.PivotLabelFilter = {
    condition: ExcelScript.LabelFilterCondition.beginsWith,
    substring: "L",
    exclusive: true
  };

  // Apply the label filter to the field.
  field.applyFilter({ labelFilter: filter });
}

Properties

condition

Specifies the condition for the filter, which defines the necessary filtering criteria.

exclusive

If true, filter excludes items that meet criteria. The default is false (filter to include items that meet criteria).

lowerBound

The lower-bound of the range for the between filter condition. Note: A numeric string is treated as a number when being compared against other numeric strings.

substring

The substring used for beginsWith, endsWith, and contains filter conditions.

upperBound

The upper-bound of the range for the between filter condition. Note: A numeric string is treated as a number when being compared against other numeric strings.

Property Details

condition

Specifies the condition for the filter, which defines the necessary filtering criteria.

condition: LabelFilterCondition;

Property Value

exclusive

If true, filter excludes items that meet criteria. The default is false (filter to include items that meet criteria).

exclusive?: boolean;

Property Value

boolean

lowerBound

The lower-bound of the range for the between filter condition. Note: A numeric string is treated as a number when being compared against other numeric strings.

lowerBound?: string;

Property Value

string

substring

The substring used for beginsWith, endsWith, and contains filter conditions.

substring?: string;

Property Value

string

upperBound

The upper-bound of the range for the between filter condition. Note: A numeric string is treated as a number when being compared against other numeric strings.

upperBound?: string;

Property Value

string