# Set-OfficeExcelColumn

Writes values or applies column layout to a worksheet in a DSL block or through the pipeline.

Project

PSWriteOffice

PowerShell document automation across OfficeIMO's document, spreadsheet, presentation, PDF, Project, Access, EPUB, invoicing, and conversion engines.

[View on GitHub](https://github.com/EvotecIT/OfficeIMO/tree/master/PowerShell/PSWriteOffice) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSWriteOffice/releases/tag/v3.0.5) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSWriteOffice/0.2.0)

Stars **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

Aliases: ExcelColumn

**Module**

`PSWriteOffice`

**Aliases**

`ExcelColumn`

**Inputs**

`OfficeIMO.Excel.ExcelDocument` `OfficeIMO.Excel.ExcelSheet`

**Source**

[SetOfficeExcelColumnCommand.cs:31](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelColumnCommand.cs#L31) 

Writes values or applies column layout to a worksheet in a DSL block or through the pipeline.

## Syntax

```
Set-OfficeExcelColumn
[-AutoFit]
[[-Column] <Int32>]
[-ColumnName <String>]
[-Document <ExcelDocument>]
[-Hidden <Boolean>]
[-PassThru]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-StartRow <Int32>]
[-Values <Object[]>]
[-Width <Double>]
[-Worksheet <ExcelSheet>]
[<CommonParameters>]
```

[#](#method-set-officeexcelcolumn-switchparameter-int32-string-exceldocument-boolean-switchparameter-string-int32-int32-object-double-excelsheet)

Parameter set: `All Parameter Sets`

## Examples

### Populate a column and auto-fit it.

```powershell
ExcelSheet 'Data' { Set-OfficeExcelColumn -Column 1 -Values 'North','South' -AutoFit }
```

Writes values into column A and adjusts the width.

### Set a readable report column width through the worksheet pipeline.

```powershell
$sheet | Set-OfficeExcelColumn -ColumnName C -Width 48
```

Sets column C to 48 Excel character units. Save the workbook after editing.

### Unhide a column in a named worksheet.

```powershell
$workbook | Set-OfficeExcelColumn -Sheet 'Review' -ColumnName C -Hidden $false -AutoFit
```

Uses the workbook pipeline target without an active DSL scope.

## Parameters

**-AutoFit SwitchParameter optional**

Auto-fit the column width after updates.

**-Column Int32 optionalposition: 0**

1-based column index.

**-ColumnName String optionalaliases: ColumnLetter, Letter**

Column letter reference (e.g., A, BC).

**-Document ExcelDocument optionalpipeline: True (ByValue)**

Workbook to modify. Accepts pipeline input; select its worksheet with Sheet or SheetIndex.

**-Hidden Boolean optional**

Hide or show the column.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Sheet String optional**

Worksheet name when using Document. The first worksheet is used when no selector is supplied.

**-SheetIndex Int32 optional**

Zero-based worksheet index when using Document.

**-StartRow Int32 optional**

Starting row index (1-based) for values.

**-Values Object[] optional**

Values to write down the column. Numeric, Boolean, and date values retain their native Excel types; strings remain text.

**-Width Double optional**

Column width in Excel character units.

**-Worksheet ExcelSheet optionalpipeline: True (ByValue)aliases: SheetObject**

Worksheet to modify outside a 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](https://learn.microsoft.com/powershell/module/microsoft.powershell.core/about/about_commonparameters).

Evotec API Reference Copyright 2026 Evotec Services

<!-- PowerForge markdown artifact sha256:DA4120D89BD421EC8B6D0585854A243E424591ACE67610CA3FAB4BDB37A51A54 -->
