Project

PSWriteOffice

PowerShell document automation across Word, Excel, PowerPoint, PDF, Reader, Confluence, Visio, and open text formats.

Stars 159
Forks 14
PowerShell Gallery downloads 158,661
Release v3.0.5
Language: C# Updated: 2026-09-03

API Reference

Cmdlet

Set-OfficeExcelFormula

Aliases: ExcelFormula
Namespace PSWriteOffice
Aliases
ExcelFormula
Inputs
None

Sets a formula in a worksheet cell.

Remarks

Supports A1 addresses or row/column coordinates in the Excel DSL.

Examples

Authored help example

Write a SUM formula.

PS>


ExcelSheet 'Data' { Set-OfficeExcelFormula -Address 'C2' -Formula 'SUM(A2:B2)' }
        

Stores the formula in cell C2.

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-OfficeExcelFormula [-Column <Int32>] -Formula <String> [-PassThru] [-Row <Int32>] [<CommonParameters>]
#
Parameter set: Coordinates

Parameters

Column Int32 optionalposition: namedpipeline: False
1-based column index.
Formula String requiredposition: namedpipeline: False
Formula text (without leading =).
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the object created or changed by the command.
Row Int32 optionalposition: namedpipeline: False
1-based row index.
Set-OfficeExcelFormula [-Address <String>] -Formula <String> [-PassThru] [<CommonParameters>]
#
Parameter set: Address

Parameters

Address String optionalposition: namedpipeline: False
A1-style cell address (e.g., A1, C5).
Formula String requiredposition: namedpipeline: False
Formula text (without leading =).
PassThru SwitchParameter optionalposition: namedpipeline: False
Emit the object created or changed by the command.