Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Add-OfficeExcelAutoFilter

Aliases: ExcelAutoFilter
Namespace PSWriteOffice
Aliases
ExcelAutoFilter
Inputs
OfficeIMO.Excel.ExcelDocument

Adds an AutoFilter to the current worksheet.

Remarks

Optional filter criteria can be supplied per column index (0-based within the range).

Examples

Authored help example

Add AutoFilter to a range.

PS>


ExcelSheet 'Data' { Add-OfficeExcelAutoFilter -Range 'A1:D200' }
        

Enables filter dropdowns on the range.

Add AutoFilter with criteria.

PS>


Add-OfficeExcelAutoFilter -Range 'A1:D200' -Criteria @{ 2 = 'Open','Hold' }
        

Filters the third column (0-based within the range) to Open/Hold.

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.

Syntax

Add-OfficeExcelAutoFilter [-Criteria <Hashtable>] [-PassThru] -Range <String> [<CommonParameters>]
#
Parameter set: Context

Parameters

Criteria Hashtable optionalposition: namedpipeline: False
Optional criteria per column index (0-based within the range).
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the object created or changed by the command.
Range String requiredposition: 0pipeline: False
A1 range to apply AutoFilter.
Add-OfficeExcelAutoFilter [-Criteria <Hashtable>] -Document <ExcelDocument> [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Int32>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Criteria Hashtable optionalposition: namedpipeline: False
Optional criteria per column index (0-based within the range).
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the object created or changed by the command.
Range String requiredposition: 0pipeline: False
A1 range to apply AutoFilter.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Int32 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.