# Set-OfficeExcelCell

Sets a cell value, formula, number format, or fill.

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: ExcelCell

**Module**

`PSWriteOffice`

**Aliases**

`ExcelCell`

**Inputs**

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

**Source**

[SetOfficeExcelCellCommand.cs:24](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelCellCommand.cs#L24) 

Sets a cell value, formula, number format, or fill.

## 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>]
```

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

Parameter set: `Coordinates`

```
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>]
```

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

Parameter set: `Address`

## Description

Supports A1 addresses or row/column coordinates for DSL-style composition.

## Examples

### Write values to A1 and B1.

```powershell
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.

```powershell
$sheet | Set-OfficeExcelCell -Address B2 -Value 42 -NumberFormat '#,##0'
```

Uses the worksheet pipeline target without an active DSL scope.

## Parameters

**-BackgroundColor String optional**

Solid background color. Named colors and hexadecimal values are accepted.

**-Column Int32 optionalsets: Coordinates**

1-based column index.

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

Workbook to modify outside a DSL context. Accepts pipeline input.

**-Formula String optional**

Formula text (without leading =).

**-GradientDegree Double optional**

Linear gradient angle in degrees.

**-GradientFrom String optional**

Gradient start color. Named colors and hexadecimal values are accepted.

**-GradientTo String optional**

Gradient end color. Named colors and hexadecimal values are accepted.

**-NumberFormat String optional**

Number format code to apply.

**-PassThru SwitchParameter optional**

Emit the object created or changed by the command.

**-Row Int32 optionalsets: Coordinates**

1-based row index.

**-Sheet String optional**

Worksheet name when using Document.

**-SheetIndex Int32 optional**

Worksheet index (0-based) when using Document.

**-Value Object optional**

Cell value to assign. 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.

**-Address String optionalsets: Address**

A1-style cell address (e.g., A1, C5).

## 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:270CC152604B900E5D2D1B43DF5C9E45BAAFE5F4509424A942DF30CF42B05083 -->
