API Reference
Cmdlet
Set-OfficeExcelCell
Sets a cell value, formula, or number format within the current worksheet.
Remarks
Supports A1 addresses or row/column coordinates for DSL-style composition.
Examples
Write values to A1 and B1.
PS>
ExcelSheet 'Data' { Set-OfficeExcelCell -Address 'A1' -Value 'Region'; Set-OfficeExcelCell -Row 1 -Column 2 -Value 'Revenue' }
Writes two headers in the first row.
Write to an explicit worksheet.
PS>
$sheet | Set-OfficeExcelCell -Address B2 -Value 42 -NumberFormat '#,##0'
Uses the worksheet pipeline target without an active DSL scope.
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
Set-OfficeExcelCell [-BackgroundColor <String>] [-Column <Int32>] [-Document <ExcelDocument>] [-Formula <String>] [-GradientDegree <Double>] [-GradientFrom <String>] [-GradientTo <String>] [-NumberFormat <String>] [-PassThru] [-Row <Int32>] [-Sheet <String>] [-SheetIndex <Int32>] [-Value <Object>] [-Worksheet <ExcelSheet>] [<CommonParameters>]#Parameter set:
CoordinatesParameters
- BackgroundColor String
- Solid background color. Named colors and hexadecimal values are accepted.
- Column Int32
- 1-based column index.
- Document ExcelDocument
- Workbook to modify outside a DSL context.
- Formula String
- Formula text (without leading =).
- GradientDegree Double
- Linear gradient angle in degrees.
- GradientFrom String
- Gradient start color. Named colors and hexadecimal values are accepted.
- GradientTo String
- Gradient end color. Named colors and hexadecimal values are accepted.
- NumberFormat String
- Number format code to apply.
- PassThru SwitchParameter
- Emit the object created or changed by the command.
- Row Int32
- 1-based row index.
- Sheet String
- Worksheet name when using Document.
- SheetIndex Int32
- Worksheet index (0-based) when using Document.
- Value Object
- Cell value to assign.
- Worksheet ExcelSheet
- Worksheet to modify outside a DSL context.
Set-OfficeExcelCell [-Address <String>] [-BackgroundColor <String>] [-Document <ExcelDocument>] [-Formula <String>] [-GradientDegree <Double>] [-GradientFrom <String>] [-GradientTo <String>] [-NumberFormat <String>] [-PassThru] [-Sheet <String>] [-SheetIndex <Int32>] [-Value <Object>] [-Worksheet <ExcelSheet>] [<CommonParameters>]#Parameter set:
AddressParameters
- Address String
- A1-style cell address (e.g., A1, C5).
- BackgroundColor String
- Solid background color. Named colors and hexadecimal values are accepted.
- Document ExcelDocument
- Workbook to modify outside a DSL context.
- Formula String
- Formula text (without leading =).
- GradientDegree Double
- Linear gradient angle in degrees.
- GradientFrom String
- Gradient start color. Named colors and hexadecimal values are accepted.
- GradientTo String
- Gradient end color. Named colors and hexadecimal values are accepted.
- NumberFormat String
- Number format code to apply.
- PassThru SwitchParameter
- Emit the object created or changed by the command.
- Sheet String
- Worksheet name when using Document.
- SheetIndex Int32
- Worksheet index (0-based) when using Document.
- Value Object
- Cell value to assign.
- Worksheet ExcelSheet
- Worksheet to modify outside a DSL context.