# Compare-OfficeExcelWorkbook

Compares two workbooks by sheets, cells, formulas, styles, tables, comments, names, and worksheet metadata.

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: ExcelWorkbookCompare

**Module**

`PSWriteOffice`

**Aliases**

`ExcelWorkbookCompare`

**Inputs**

`OfficeIMO.Excel.ExcelDocument`

**Outputs**

`System.Management.Automation.PSObject`

**Source**

[CompareOfficeExcelWorkbookCommand.cs:24](https://github.com/EvotecIT/PSWriteOffice/blob/main/Sources/PSWriteOffice/Cmdlets/Excel/CompareOfficeExcelWorkbookCommand.cs#L24) 

Compares two workbooks by sheets, cells, formulas, styles, tables, comments, names, and worksheet metadata.

## Syntax

```
Compare-OfficeExcelWorkbook
[-DifferencePath] <String>
[-MaxDifferences <Int32>]
[-Path] <String>
[-SkipCells]
[-SkipCellStyles]
[-SkipComments]
[-SkipNamedRanges]
[-SkipTables]
[-SkipWorksheetMetadata]
[<CommonParameters>]
```

[#](#method-compare-officeexcelworkbook-string-int32-string-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter)

Parameter set: `Path`

```
Compare-OfficeExcelWorkbook
-DifferenceDocument <ExcelDocument>
-Document <ExcelDocument>
[-MaxDifferences <Int32>]
[-SkipCells]
[-SkipCellStyles]
[-SkipComments]
[-SkipNamedRanges]
[-SkipTables]
[-SkipWorksheetMetadata]
[<CommonParameters>]
```

[#](#method-compare-officeexcelworkbook-exceldocument-exceldocument-int32-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter-switchparameter)

Parameter set: `Document`

## Examples

### Compare two generated workbooks before publishing a refreshed report.

```powershell
$diff = Compare-OfficeExcelWorkbook -Path .\Expected.xlsx -DifferencePath .\Actual.xlsx -MaxDifferences 500
if (-not $diff.AreEqual) {
    $diff.Differences |
        Sort-Object Category,SheetName,Address |
        Format-Table Category,SheetName,Address,Message,LeftValue,RightValue
}
```

Uses OfficeIMO's reusable workbook diff engine and includes structural metadata by default, not just visible cell values.

## Parameters

**-DifferencePath String requiredposition: 1sets: Path**

Workbook path to compare against.

**-MaxDifferences Int32 optional**

Maximum number of differences to report.

**-Path String requiredposition: 0aliases: InputPath, ReferencePathsets: Path**

Workbook path.

**-SkipCells SwitchParameter optional**

Skip visible cell value and formula comparison.

**-SkipCellStyles SwitchParameter optional**

Skip style-index comparison for used cells.

**-SkipComments SwitchParameter optional**

Skip legacy and threaded comment comparison.

**-SkipNamedRanges SwitchParameter optional**

Skip workbook and sheet-scoped named-range comparison.

**-SkipTables SwitchParameter optional**

Skip table metadata comparison.

**-SkipWorksheetMetadata SwitchParameter optional**

Skip worksheet view, validation, and filter metadata comparison.

**-DifferenceDocument ExcelDocument requiredsets: Document**

Workbook document to compare against.

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

Workbook document.

## 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:381D47775687DC30B74330443C3203E5DDB46587E672F24B5C26F68F7819F12B -->
