API Reference

Cmdlet

Clear-OfficeExcelDataValidation

Aliases: ExcelDataValidationClear
Namespace PSWriteOffice
Aliases
ExcelDataValidationClear
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Object

Clears data validation rules from one or more Excel worksheets.

Remarks

Clears data validation rules from one or more Excel worksheets.

Examples

Authored help example

Clear validations from a target range.

PS>


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.

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

Clear-OfficeExcelDataValidation [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Context

Parameters

HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the range to clear.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
Range String optionalposition: namedpipeline: False
Optional A1 range to clear. When omitted, all data validations on the selected sheet are cleared.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.

Outputs

System.Object

Clear-OfficeExcelDataValidation [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] -InputPath <String> [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Path

Parameters

HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the range to clear.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
InputPath String requiredposition: 0pipeline: Falsealiases: FilePath, Path
Workbook path to update.
Range String optionalposition: namedpipeline: False
Optional A1 range to clear. When omitted, all data validations on the selected sheet are cleared.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.

Outputs

System.Object

Clear-OfficeExcelDataValidation -Document <ExcelDocument> [-HeaderName <String>] [-HeaderRow <Int32>] [-IncludeHeader] [-Range <String>] [-Sheet <String>] [-SheetIndex <Nullable`1>] [-TableName <String>] [<CommonParameters>]
#
Parameter set: Document

Parameters

Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to update outside the DSL context.
HeaderName String optionalposition: namedpipeline: Falsealiases: ColumnName
Header or table column name used to resolve the range to clear.
HeaderRow Int32 optionalposition: namedpipeline: False
Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
IncludeHeader SwitchParameter optionalposition: namedpipeline: False
Include the header cell in the resolved range.
Range String optionalposition: namedpipeline: False
Optional A1 range to clear. When omitted, all data validations on the selected sheet are cleared.
Sheet String optionalposition: namedpipeline: False
Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.
TableName String optionalposition: namedpipeline: False
Optional table name for header-based range resolution.

Outputs

System.Object