Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeExcelSlicer

Aliases: ExcelSlicer
Module
PSWriteOffice
Aliases
ExcelSlicer
Inputs
OfficeIMO.Excel.ExcelDocument

Adds slicer or timeline binding metadata for a pivot table or table.

Syntax

Add-OfficeExcelSlicer
[-Document <ExcelDocument>]
-Name <String>
[-PassThru]
[-PivotTable <String>]
[-SourceName <String>]
[-Timeline]
[-Xml <String>]
[<CommonParameters>]
#
Parameter set: Default

Examples

Add a slicer for a pivot field

Open-OfficeExcel -Path .\Reports\Sales-2026.xlsx {
    ExcelSlicer -Name RegionSlicer -SourceName Region -PivotTable SalesPivot
}

Adds slicer metadata for the Region field of the SalesPivot pivot table.

Add a timeline for order dates

Open-OfficeExcel -Path .\Reports\Sales-2026.xlsx {
    ExcelSlicer -Name OrderDateTimeline -SourceName OrderDate -PivotTable SalesPivot -Timeline
}

Adds timeline metadata for the OrderDate field so readers can filter the pivot table by period in Excel.

Parameters

-Document ExcelDocument optionalpipeline: True (ByValue)
Caller-owned workbook; omission uses the enclosing Excel content block.
-Name String required
Slicer cache name.
-PassThru SwitchParameter optional
Emits the native result after the operation.
-PivotTable String optional
Native pivot table whose data or entire range is targeted.
-SourceName String optional
Source field, table column, or pivot field name.
-Timeline SwitchParameter optional
Creates timeline metadata instead of a standard slicer.
-Xml String optional
Caller-supplied slicer cache XML. When provided, OfficeIMO preserves it within its pivot-interaction metadata envelope.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.