# Invoke-OfficeExcelTemplate

Applies Excel template markers such as {{Name}} to one or more worksheets.

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: ExcelTemplate, ExcelTemplateApply

**Module**

`PSWriteOffice`

**Aliases**

`ExcelTemplate` `ExcelTemplateApply`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`System.Int32`

**Source**

[InvokeOfficeExcelTemplateCommand.cs:18](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/InvokeOfficeExcelTemplateCommand.cs#L18) 

Applies Excel template markers such as {{Name}} to one or more worksheets.

## Syntax

```
Invoke-OfficeExcelTemplate
[-CultureName <String>]
[-MissingValueBehavior <PreserveMarker|EmptyString|Throw>]
[-PassThru]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-ThrowOnMissing]
-Value <Hashtable>
[<CommonParameters>]
```

[#](#method-invoke-officeexceltemplate-string-exceltemplatemissingvaluebehavior-switchparameter-string-int32-switchparameter-hashtable)

Parameter set: `Context`

```
Invoke-OfficeExcelTemplate
[-CultureName <String>]
[-MissingValueBehavior <PreserveMarker|EmptyString|Throw>]
[-PassThru]
[-Path] <String>
[-Sheet <String>]
[-SheetIndex <Int32>]
[-ThrowOnMissing]
-Value <Hashtable>
[<CommonParameters>]
```

[#](#method-invoke-officeexceltemplate-string-exceltemplatemissingvaluebehavior-switchparameter-string-string-int32-switchparameter-hashtable)

Parameter set: `Path`

```
Invoke-OfficeExcelTemplate
[-CultureName <String>]
-Document <ExcelDocument>
[-MissingValueBehavior <PreserveMarker|EmptyString|Throw>]
[-PassThru]
[-Sheet <String>]
[-SheetIndex <Int32>]
[-ThrowOnMissing]
-Value <Hashtable>
[<CommonParameters>]
```

[#](#method-invoke-officeexceltemplate-string-exceldocument-exceltemplatemissingvaluebehavior-switchparameter-string-int32-switchparameter-hashtable)

Parameter set: `Document`

## Examples

### Fill a workbook template from a hashtable.

```powershell
Invoke-OfficeExcelTemplate -Path .\Invoice.xlsx -Sheet Invoice -Value @{ Number = 'INV-001'; Total = 123.45 } -CultureName en-US
```

Replaces matching template markers and saves the workbook.

## Parameters

**-CultureName String optional**

Culture name used for built-in marker format aliases such as currency and date.

**-MissingValueBehavior ExcelTemplateMissingValueBehavior optional**

Behavior used when a marker is not supplied by -Value.

Possible values: `PreserveMarker`, `EmptyString`, `Throw`

**-PassThru SwitchParameter optional**

Returns the number of marker replacements.

**-Sheet String optional**

Worksheet name to update. Defaults to the current DSL sheet or all workbook sheets.

**-SheetIndex Int32 optional**

Worksheet index (0-based) to update. Defaults to the current DSL sheet or all workbook sheets.

**-ThrowOnMissing SwitchParameter optional**

Throws when a marker is not supplied by -Value.

**-Value Hashtable requiredaliases: Values**

Template marker values keyed by marker name.

**-Path String requiredposition: 0aliases: FilePath, InputPathsets: Path**

Workbook path to update.

**-Document ExcelDocument requiredpipeline: True (ByValue)sets: Document**

Workbook to update outside the DSL context.

## 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:250321C194A47F7BE523A434DB404538234667C2CA6CBFDFA5004B72A55DBDA5 -->
