API Reference
Cmdlet
Compare-OfficeExcelWorkbook
Compares two workbooks by sheets, cells, formulas, styles, tables, comments, names, and worksheet metadata.
Remarks
Compares two workbooks by sheets, cells, formulas, styles, tables, comments, names, and worksheet metadata.
Examples
Compare two generated workbooks before publishing a refreshed report.
PS>
$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.
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.
Syntax
Compare-OfficeExcelWorkbook -DifferencePath <String> -InputPath <String> [-MaxDifferences <Int32>] [-SkipCells] [-SkipCellStyles] [-SkipComments] [-SkipNamedRanges] [-SkipTables] [-SkipWorksheetMetadata] [<CommonParameters>]#Parameter set:
PathParameters
- DifferencePath String
- Workbook path to compare against.
- InputPath String
- Workbook path.
- MaxDifferences Int32
- Maximum number of differences to report.
- SkipCells SwitchParameter
- Skip visible cell value and formula comparison.
- SkipCellStyles SwitchParameter
- Skip style-index comparison for used cells.
- SkipComments SwitchParameter
- Skip legacy and threaded comment comparison.
- SkipNamedRanges SwitchParameter
- Skip workbook and sheet-scoped named-range comparison.
- SkipTables SwitchParameter
- Skip table metadata comparison.
- SkipWorksheetMetadata SwitchParameter
- Skip worksheet view, validation, and filter metadata comparison.
Outputs
System.Management.Automation.PSObject
Compare-OfficeExcelWorkbook -DifferenceDocument <ExcelDocument> -Document <ExcelDocument> [-MaxDifferences <Int32>] [-SkipCells] [-SkipCellStyles] [-SkipComments] [-SkipNamedRanges] [-SkipTables] [-SkipWorksheetMetadata] [<CommonParameters>]#Parameter set:
DocumentParameters
- DifferenceDocument ExcelDocument
- Workbook document to compare against.
- Document ExcelDocument
- Workbook document.
- MaxDifferences Int32
- Maximum number of differences to report.
- SkipCells SwitchParameter
- Skip visible cell value and formula comparison.
- SkipCellStyles SwitchParameter
- Skip style-index comparison for used cells.
- SkipComments SwitchParameter
- Skip legacy and threaded comment comparison.
- SkipNamedRanges SwitchParameter
- Skip workbook and sheet-scoped named-range comparison.
- SkipTables SwitchParameter
- Skip table metadata comparison.
- SkipWorksheetMetadata SwitchParameter
- Skip worksheet view, validation, and filter metadata comparison.
Outputs
System.Management.Automation.PSObject