# Invoke-OfficeWordMailMerge

Executes a simple mail merge against MERGEFIELD values in a Word document.

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 **727**

Forks **84**

Open issues **7**

Total downloads **5,275,783**

Release **OfficeIMO-v3.6.2**

Language: C# Updated: 2026-11-24

Cmdlet 

**Module**

`PSWriteOffice`

**Inputs**

`OfficeIMO.Word.WordDocument`

**Outputs**

`OfficeIMO.Word.WordDocument`

**Source**

[InvokeOfficeWordMailMergeCommand.cs:21](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Word/InvokeOfficeWordMailMergeCommand.cs#L21) 

Executes a simple mail merge against MERGEFIELD values in a Word document.

## Syntax

```
Invoke-OfficeWordMailMerge
[-Document <WordDocument>]
[-InputObject] <Object>
[-PassThru]
[-PreserveFields]
[<CommonParameters>]
```

[#](#method-invoke-officewordmailmerge-worddocument-object-switchparameter-switchparameter)

Parameter set: `All Parameter Sets`

## Examples

### Replace merge fields from a hashtable.

```powershell
Invoke-OfficeWordMailMerge -InputObject @{ FirstName = 'John'; OrderId = 12345 }
```

Updates MERGEFIELD values in the active Word document.

## Parameters

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

Document to update when provided explicitly.

**-InputObject Object requiredposition: 0aliases: Data, Values**

Hashtable or object whose properties map to MERGEFIELD names.

**-PassThru SwitchParameter optional**

Emit the updated document.

**-PreserveFields SwitchParameter optional**

Preserve field codes and only update displayed field text.

## 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:C6BE89556416D969FC5DEC987FFD6C40DE56F5703C71EDAE1A1895B53CBF681B -->
