# Set-OfficeExcelTheme

Sets or resets the workbook theme package part for an Excel workbook.

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 

Aliases: ExcelTheme

**Module**

`PSWriteOffice`

**Aliases**

`ExcelTheme`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`System.Management.Automation.PSObject`

**Source**

[SetOfficeExcelThemeCommand.cs:20](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/SetOfficeExcelThemeCommand.cs#L20) 

Sets or resets the workbook theme package part for an Excel workbook.

## Syntax

```
Set-OfficeExcelTheme
[-Default]
[-Name <String>]
[-PassThru]
[-Xml <String>]
[-XmlPath <String>]
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-switchparameter-string-switchparameter-string-string)

Parameter set: `Context`

```
Set-OfficeExcelTheme
[-Default]
[-Name <String>]
[-PassThru]
[-Path] <String>
[-Xml <String>]
[-XmlPath <String>]
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-switchparameter-string-switchparameter-string-string-string)

Parameter set: `Path`

```
Set-OfficeExcelTheme
[-Default]
-Document <ExcelDocument>
[-Name <String>]
[-PassThru]
[-Xml <String>]
[-XmlPath <String>]
[<CommonParameters>]
```

[#](#method-set-officeexceltheme-switchparameter-exceldocument-string-switchparameter-string-string)

Parameter set: `Document`

## Examples

### Reset and rename the workbook theme.

```powershell
$theme = Set-OfficeExcelTheme -Path .\Report.xlsx -Default -Name 'Contoso Workbook Theme' -PassThru
Get-OfficeExcelSummary -Path .\Report.xlsx |
    Select-Object Path, WorksheetCount
```

Writes the built-in OfficeIMO workbook theme and updates its theme name.

## Parameters

**-Default SwitchParameter optional**

Reset the workbook to the built-in OfficeIMO theme.

**-Name String optional**

Optional workbook theme name to apply after writing the theme.

**-PassThru SwitchParameter optional**

Emit workbook theme metadata after applying the update.

**-Xml String optional**

Theme XML to write to the workbook theme part.

**-XmlPath String optional**

Path to a DrawingML theme XML file.

**-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:5E80979A5A97C3355C2E642301673E503377DF6BB387A6AA0FA0D06C28E970B0 -->
