Set-OfficeExcelRow
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>]#All Parameter SetsExamples
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 -AutoFitPreserves 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
- Auto-fit row height after writing values and applying style.
- -BackgroundColor String
- Apply a background color across the target row span.
- -Bold Boolean
- Apply or clear bold styling across the target row span.
- -ClearHeight SwitchParameter
- Clear any custom row height.
- -Document ExcelDocument
- Workbook to modify. Accepts pipeline input; select its worksheet with Sheet or SheetIndex.
- -FirstColumn Int32
- First 1-based column affected by style options.
- -FontName String
- Apply a font family across the target row span.
- -Height Double
- Explicit row height in points.
- Hide or unhide the row. Use -Hidden:$false to unhide.
- -Italic Boolean
- Apply or clear italic styling across the target row span.
- -LastColumn Int32
- Last 1-based column affected by style options.
- -PassThru SwitchParameter
- Emit the object created or changed by the command.
- -Row Int32
- 1-based row index.
- -Sheet String
- Worksheet name when using Document. The first worksheet is used when no selector is supplied.
- -SheetIndex Int32
- Zero-based worksheet index when using Document.
- -StartColumn Int32
- Starting column index (1-based).
- -Underline Boolean
- Apply or clear underline styling across the target row span.
- -Values Object[]
- Values to write across the row. Numeric, Boolean, and date values retain their native Excel types; strings remain text.
- -Worksheet ExcelSheet
- Worksheet to modify outside a DSL context.
- -WrapText Boolean
- 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.