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-OfficeExcelFormula

Aliases: ExcelFormula
Module
PSWriteOffice
Aliases
ExcelFormula
Inputs
None

Sets a formula in a worksheet cell.

Syntax

Set-OfficeExcelFormula
[-Column <Int32>]
-Formula <String>
[-PassThru]
[-Row <Int32>]
[<CommonParameters>]
#
Parameter set: Coordinates
Set-OfficeExcelFormula
[-Address <String>]
-Formula <String>
[-PassThru]
[<CommonParameters>]
#
Parameter set: Address

Description

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

Examples

Write a SUM formula.

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

Stores the formula in cell C2.

Parameters

-Column Int32 optionalsets: Coordinates
1-based column index.
-Formula String required
Formula text (without leading =).
-PassThru SwitchParameter optional
Emit the object created or changed by the command.
-Row Int32 optionalsets: Coordinates
1-based row index.
-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.