Project

PSWriteOffice

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

Stars 654
Forks 82
Open issues 1
Total downloads 4,320,051
Release OfficeIMO-v3.5.3
Language: C# Updated: 2026-11-03
Cmdlet

Set-OfficeExcelRow

Aliases: ExcelRow
Module
PSWriteOffice
Aliases
ExcelRow
Inputs
OfficeIMO.Excel.ExcelDocument OfficeIMO.Excel.ExcelSheet

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>]
#
Parameter set: All Parameter Sets

Examples

Write a row starting at column A.

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.

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

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