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

Clear-OfficeExcelDataValidation

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

Clears data validation rules from one or more Excel worksheets.

Syntax

Clear-OfficeExcelDataValidation
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[-PassThru]
[-Range <String>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-TableName <String>]
[<CommonParameters>]
#
Parameter set: Context
Clear-OfficeExcelDataValidation
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[-PassThru]
[-Path] <String>
[-Range <String>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-TableName <String>]
[<CommonParameters>]
#
Parameter set: Path
Clear-OfficeExcelDataValidation
-Document <ExcelDocument>
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[-PassThru]
[-Range <String>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-TableName <String>]
[<CommonParameters>]
#
Parameter set: Document

Examples

Clear validations from a target range.

Clear-OfficeExcelDataValidation -Path .\Report.xlsx -Sheet Data -HeaderName Owner -TableName ServiceHealth -Confirm:$false
Get-OfficeExcelDataValidation -Path .\Report.xlsx -Sheet Data |
    Where-Object Range -like '*Owner*'

Removes validation metadata that overlaps the target range and saves the workbook.

Parameters

-HeaderName String optionalaliases: ColumnName
Header or table column name used to resolve the range to clear.
-HeaderRow Int32 optional
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
-IncludeHeader SwitchParameter optional
Include the header cell in the resolved range.
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Range String optional
Optional A1 range to clear. When omitted, all data validations on the selected sheet are cleared.
-Sheet String optional
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
-SheetIndex Int32 optional
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
-TableName String optional
Optional table name for header-based range resolution.
-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.