Cmdlet
Add-OfficeExcelValidationTime
Adds a time data validation rule to a worksheet range.
Syntax
Add-OfficeExcelValidationTime
[-AllowBlank <Boolean>]
[-ErrorMessage <String>]
[-ErrorTitle <String>]
[-Formula1] <TimeSpan>
[-Formula2 <TimeSpan>]
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[-Operator] <ExcelDataValidationOperator>
[-PassThru]
[[-Range] <String>]
[-TableName <String>]
[<CommonParameters>]#Parameter set:
ContextAdd-OfficeExcelValidationTime
[-AllowBlank <Boolean>]
-Document <ExcelDocument>
[-ErrorMessage <String>]
[-ErrorTitle <String>]
[-Formula1] <TimeSpan>
[-Formula2 <TimeSpan>]
[-HeaderName <String>]
[-HeaderRow <Int32>]
[-IncludeHeader]
[-Operator] <ExcelDataValidationOperator>
[-PassThru]
[[-Range] <String>]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-TableName <String>]
[<CommonParameters>]#Parameter set:
DocumentExamples
Restrict values to before 5PM.
ExcelSheet 'Data' { Add-OfficeExcelValidationTime -Range 'D2:D20' -Operator LessThan -Formula1 ([TimeSpan]::FromHours(17)) }Ensures times in D2:D20 are before 17:00.
Parameters
- -AllowBlank Boolean
- Allow blank values.
- -ErrorMessage String
- Error message shown to the user.
- -ErrorTitle String
- Error title shown to the user.
- -Formula1 TimeSpan
- Primary time bound.
- -Formula2 TimeSpan
- Optional secondary time bound.
- -HeaderName String
- Header or table column name used to resolve the target range.
- -HeaderRow Int32
- Worksheet header row used when resolving HeaderName without a table. Use 0 for the first row of the used range.
- -IncludeHeader SwitchParameter
- Include the header cell in the resolved range.
- -Operator ExcelDataValidationOperator
- Validation operator.
- Possible values:
Between,NotBetween,Equal,NotEqual,LessThan,LessThanOrEqual,GreaterThan,GreaterThanOrEqual - -PassThru SwitchParameter
- Emit the range string after applying validation.
- -Range String
- Target range in A1 notation.
- -TableName String
- Optional table name for header-based range resolution.
- -Document ExcelDocument
- Workbook to operate on outside the DSL context.
- -Sheet String
- Worksheet name when using Document.
- -SheetIndex Int32
- Worksheet index (0-based) 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.