Evotec

Project

PSWriteOffice

PSWriteOffice is an open-source PowerShell and .NET project with packages, release history, and technical documentation.

Stars 144
Forks 12
Open issues 16
PowerShell Gallery downloads 150,904
Release v0.2.0
Language: C# Updated: 2026-04-06

API Reference

Cmdlet

Add-OfficeExcelValidationList

Namespace PSWriteOffice
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
System.Object

Adds a list-based data validation to a worksheet range.

Remarks

When invoked inside the Excel DSL, applies to the current worksheet.

Examples

Authored help example

Add a validation list to a range.

PS>


ExcelSheet 'Data' { Add-OfficeExcelValidationList -Range 'C2:C50' -Values 'New','In Progress','Done' }
        

Restricts column C to the provided values.

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-OfficeExcelValidationList [-AllowBlank <Boolean>] [-PassThru] -Range <String> -Values <String[]> [<CommonParameters>]
#
Parameter set: Context

Parameters

AllowBlank Boolean optionalposition: namedpipeline: False
Allow blank values.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range string after applying validation.
Range String requiredposition: 0pipeline: False
Target range in A1 notation.
Values String[] requiredposition: 1pipeline: False
Allowed values for the dropdown list.

Outputs

System.Object

Add-OfficeExcelValidationList [-AllowBlank <Boolean>] -Document <ExcelDocument> [-PassThru] -Range <String> [-Sheet <String>] [-SheetIndex <Nullable`1>] -Values <String[]> [<CommonParameters>]
#
Parameter set: Document

Parameters

AllowBlank Boolean optionalposition: namedpipeline: False
Allow blank values.
Document ExcelDocument requiredposition: namedpipeline: True (ByValue)
Workbook to operate on outside the DSL context.
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the range string after applying validation.
Range String requiredposition: 0pipeline: False
Target range in A1 notation.
Sheet String optionalposition: namedpipeline: False
Worksheet name when using Document.
SheetIndex Nullable`1 optionalposition: namedpipeline: False
Worksheet index (0-based) when using Document.
Values String[] requiredposition: 1pipeline: False
Allowed values for the dropdown list.

Outputs

System.Object