Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Add-OfficeExcelSlicer

Aliases: ExcelSlicer
Module
PSWriteOffice
Aliases
ExcelSlicer
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Management.Automation.PSObject

Adds OfficeIMO-owned workbook slicer binding metadata.

Syntax

Add-OfficeExcelSlicer
-Name <String>
[-PassThru]
[-PivotTableName <String>]
[-SourceName <String>]
[-Xml <String>]
[<CommonParameters>]
#
Parameter set: Context
Add-OfficeExcelSlicer
-Name <String>
[-PassThru]
[-Path] <String>
[-PivotTableName <String>]
[-SourceName <String>]
[-Xml <String>]
[<CommonParameters>]
#
Parameter set: Path
Add-OfficeExcelSlicer
-Document <ExcelDocument>
-Name <String>
[-PassThru]
[-PivotTableName <String>]
[-SourceName <String>]
[-Xml <String>]
[<CommonParameters>]
#
Parameter set: Document

Examples

Add slicer binding metadata for a pivot field.

$slicer = Add-OfficeExcelSlicer -Path .\Report.xlsx -Name RegionSlicer -SourceName Region -PivotTableName SalesPivot -PassThru
Get-OfficeExcelDataModel -Path .\Report.xlsx |
    Select-Object -ExpandProperty SlicerCacheCount

Writes portable OfficeIMO binding metadata. It does not create native Excel slicer caches or UI shapes.

Parameters

-Name String required
Slicer cache name.
-PassThru SwitchParameter optional
Emit metadata about the added package part.
-PivotTableName String optional
Pivot table name the slicer is intended to filter.
-SourceName String optional
Source field, table column, or pivot field name.
-Xml String optional
Caller-supplied slicer cache XML. When provided, OfficeIMO preserves it within its pivot-interaction metadata envelope.
-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path
Workbook path to update.
-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document
Workbook to update outside the DSL context.

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.