API Reference
Command
Add-OfficeExcelValidationDate
Adds a date data validation rule to a worksheet range.
Remarks
Adds a date data validation rule to a worksheet range.
Examples
Restrict values after a date.
PS>ExcelSheet 'Data' { Add-OfficeExcelValidationDate -Range 'C2:C20' -Operator GreaterThan -Formula1 (Get-Date '2024-01-01') }
Ensures dates in C2:C20 are after 2024-01-01.
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-OfficeExcelValidationDate [-AllowBlank <Boolean>] [-ErrorMessage <String>] [-ErrorTitle <String>] -Formula1 <DateTime> [-Formula2 <Nullable`1>] -Operator <String> [-PassThru] -Range <String> [<CommonParameters>]#Parameter set:
ContextParameters
- AllowBlank Boolean
- Allow blank values.
- ErrorMessage String
- Error message shown to the user.
- ErrorTitle String
- Error title shown to the user.
- Formula1 DateTime
- Primary date bound.
- Formula2 Nullable`1
- Optional secondary date bound.
- Operator String
- Validation operator.
- PassThru SwitchParameter
- Emit the range string after applying validation.
- Range String
- Target range in A1 notation.
Outputs
System.Object
Add-OfficeExcelValidationDate [-AllowBlank <Boolean>] -Document <ExcelDocument> [-ErrorMessage <String>] [-ErrorTitle <String>] -Formula1 <DateTime> [-Formula2 <Nullable`1>] -Operator <String> [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] [<CommonParameters>]#Parameter set:
DocumentParameters
- AllowBlank Boolean
- Allow blank values.
- Document ExcelDocument
- Workbook to operate on outside the DSL context.
- ErrorMessage String
- Error message shown to the user.
- ErrorTitle String
- Error title shown to the user.
- Formula1 DateTime
- Primary date bound.
- Formula2 Nullable`1
- Optional secondary date bound.
- Operator String
- Validation operator.
- PassThru SwitchParameter
- Emit the range string after applying validation.
- Range String
- Target range in A1 notation.
- Sheet String
- Worksheet name when using Document.
- SheetIndex Nullable`1
- Worksheet index (0-based) when using Document.
Outputs
System.Object