# Set-OfficeExcelRow

Writes values and applies row 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 **725**

Forks **84**

Open issues **3**

Total downloads **5,231,343**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-23

Cmdlet 

Aliases: ExcelRow

**Module**

`PSWriteOffice`

**Aliases**

`ExcelRow`

**Inputs**

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

**Source**

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

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

## Syntax

```
Set-OfficeExcelRow
[-AutoFit]
[-BackgroundColor <String>]
[-Bold <Boolean>]
[-ClearHeight]
[-Document <ExcelDocument>]
[-FirstColumn <Int32>]
[-FontName <String>]
[-Height <Double>]
[-Hidden <Boolean>]
[-Italic <Boolean>]
[-LastColumn <Int32>]
[-PassThru]
[-Row] <Int32>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-StartColumn <Int32>]
[-Underline <Boolean>]
[[-Values] <Object[]>]
[-Worksheet <ExcelSheet>]
[-WrapText <Boolean>]
[<CommonParameters>]
```

[#](#member-01d7cd47c58a39c11559f0fd)

Parameter set: `All Parameter Sets`

## Examples

### Write a row starting at column A.

```powershell
ExcelSheet 'Data' { Set-OfficeExcelRow -Row 2 -Values 'North', 1200 }
```

Writes two values into row 2, columns A and B.

### Wrap a report row and adjust its height through the worksheet pipeline.

```powershell
$sheet | Set-OfficeExcelRow -Row 2 -WrapText $true -AutoFit
```

Preserves existing cell formatting while wrapping the used row span and fitting its height. Save the workbook after editing.

### Update a named worksheet through the workbook pipeline.

```powershell
$workbook | Set-OfficeExcelRow -Sheet 'Review' -Row 2 -Values 'Identity', 'Ready'
```

Selects the worksheet by name without opening a DSL scope.

## Parameters

**-AutoFit SwitchParameter optional**

Auto-fit row height after writing values and applying style.

**-BackgroundColor String optional**

Apply a background color across the target row span.

**-Bold Boolean optional**

Apply or clear bold styling across the target row span.

**-ClearHeight SwitchParameter optional**

Clear any custom row height.

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

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

**-FirstColumn Int32 optional**

First 1-based column affected by style options.

**-FontName String optional**

Apply a font family across the target row span.

**-Height Double optional**

Explicit row height in points.

**-Hidden Boolean optional**

Hide or unhide the row. Use -Hidden:$false to unhide.

**-Italic Boolean optional**

Apply or clear italic styling across the target row span.

**-LastColumn Int32 optional**

Last 1-based column affected by style options.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Row Int32 requiredposition: 0**

1-based row index.

**-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.

**-StartColumn Int32 optional**

Starting column index (1-based).

**-Underline Boolean optional**

Apply or clear underline styling across the target row span.

**-Values Object[] optionalposition: 1**

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

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

Worksheet to modify outside a DSL context.

**-WrapText Boolean optional**

Apply or clear wrap text across the target row span.

## 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:72E50B92F6E38ED120A5A93E7700ACDCC6FCDEC9E6904EFEE8601C70B5F5094C -->
