Cmdlet
Add-OfficeExcelSlicer
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:
DefaultExamples
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
- Caller-owned workbook; omission uses the enclosing Excel content block.
- -Name String
- Slicer cache name.
- -PassThru SwitchParameter
- Emits the native result after the operation.
- -PivotTable String
- Native pivot table whose data or entire range is targeted.
- -SourceName String
- Source field, table column, or pivot field name.
- -Timeline SwitchParameter
- Creates timeline metadata instead of a standard slicer.
- -Xml String
- 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.