Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Clear-OfficeExcelAutoFilter

Module
PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument

Clears any AutoFilter on the current worksheet.

Syntax

Clear-OfficeExcelAutoFilter
[-Document <ExcelDocument>]
[-PassThru]
[-Sheet <OfficeSheetSelector>]
[<CommonParameters>]
#
Parameter set: Default

Examples

Remove the AutoFilter from a sheet

Open-OfficeExcel -Path .\Reports\Helpdesk.xlsx {
    ExcelSheet 'Tickets' {
        Clear-OfficeExcelAutoFilter
    }
}

Removes the filter buttons and any filter conditions from the Tickets sheet.

Clear filters before sharing a workbook

$book = Open-OfficeExcel -Path .\Reports\Q3-Sales.xlsx
foreach ($sheet in 'Orders', 'Returns', 'Customers') {
    Clear-OfficeExcelAutoFilter -Document $book -Sheet $sheet
}
Save-OfficeExcel -Document $book -Path .\Outbox\Q3-Sales.xlsx -PassThru | Close-OfficeExcel

Removes the filters left on the working sheets so recipients see every row.

Parameters

-Document ExcelDocument optionalpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Sheet OfficeSheetSelector optional
Worksheet name when using Document.

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.