Skip to content

About

Command-line helper that compares two `.xlsx` / `.xlsm` workbooks as normalized row multisets by reading the Open XML data directly.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ExcelMultisetComparer

Overview

Command-line helper that compares two .xlsx / .xlsm workbooks as normalized row multisets by reading the Open XML data directly. Row order is ignored, but duplicate row counts are preserved.

The tool is intentionally generic. It does not know about a specific file type or row marker. It compares worksheet cell values from the Open XML sheetData entries, resolving shared strings and inline strings. Styles, column widths, workbook metadata, and formatting-only differences are ignored.

Requirements

  • .NET 10 SDK for building, testing, and publishing.
  • .NET 10 runtime when running a framework-dependent build.
  • No Microsoft Excel installation is required. The tool reads the workbook package directly.

Project Structure

src/ExcelMultisetComparer/          Application source
tests/ExcelMultisetComparer.Tests/  Unit tests
ExcelMultisetComparison.slnx        Solution file

Build

From the repository root, build the solution:

dotnet build ExcelMultisetComparison.slnx -c Release

For a Debug build, omit -c Release:

dotnet build ExcelMultisetComparison.slnx

Test

Run the unit tests from the repository root:

dotnet test ExcelMultisetComparison.slnx

Publish

Publish a self-contained single-file executable for the target operating system.

Windows x64:

dotnet publish src/ExcelMultisetComparer/ExcelMultisetComparer.csproj -c Release -r win-x64 -p:PublishSingleFile=true --self-contained true

Linux x64:

dotnet publish src/ExcelMultisetComparer/ExcelMultisetComparer.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained true

macOS Apple Silicon:

dotnet publish src/ExcelMultisetComparer/ExcelMultisetComparer.csproj -c Release -r osx-arm64 -p:PublishSingleFile=true --self-contained true

The published executable is written below:

src/ExcelMultisetComparer/bin/Release/net10.0/<runtime-identifier>/publish/

Use --self-contained false if the target machine already has the required .NET runtime installed and you prefer a smaller framework-dependent output.

Run

Run without publishing:

dotnet run --project src/ExcelMultisetComparer/ExcelMultisetComparer.csproj -- --left old.xlsx --right new.xlsx

Run a published executable on Windows:

ExcelMultisetComparer.exe --left old.xlsx --right new.xlsx

Run a published executable on Linux or macOS:

./ExcelMultisetComparer --left old.xlsx --right new.xlsx

Usage

ExcelMultisetComparer.exe --left old.xlsx --right new.xlsx

Useful options:

Parameter Description Default
--left, -l Left Excel file. Required
--right, -r Right Excel file. Required
--sheet, -s Compare only one worksheet by name. All sheets
--skipRows Skip rows from the top of each used worksheet range. 0
--firstCellEquals Compare only rows whose normalized column A value equals the given value. Disabled
--caseInsensitive Compare values case-insensitively. false
--preserveWhitespace Keep leading and trailing whitespace. Trimmed
--includeEmptyRows Include empty rows that are present in the worksheet XML. Ignored
--sampleSize Number of distinct differences printed per side. 10

Examples

ExcelMultisetComparer.exe --left old.xlsx --right new.xlsx
ExcelMultisetComparer.exe -l old.xlsx -r new.xlsx --sheet Worksheet1 --firstCellEquals DoB

Exit Codes

Code Meaning
0 Equal as normalized multisets.
1 Differences found.
2 Invalid arguments or comparison error.

About

Command-line helper that compares two `.xlsx` / `.xlsm` workbooks as normalized row multisets by reading the Open XML data directly.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages