A .NET CLI tool for comparing two Excel files and identifying cell-level differences.
ExcelComparer is a command-line tool that compares two Excel files (.xlsx or .xls) and generates a detailed report of all differences found at the cell level. The tool analyzes the used ranges in both files and reports:
- Number of rows and columns with values in each file
- Cell-by-cell comparison with exact differences
- Sheet-level comparison for multi-sheet workbooks
- Comprehensive difference report saved as a text file
- .NET 10.0 or higher
- GemBox.Spreadsheet license key (Free limited license available at https://www.gemboxsoftware.com/spreadsheet/free-version)
The tool is deployed as a single-file executable at:
R:\Development\Tools\ExcelComparer.exe
git clone https://github.com/PsclPtrs/ExcelComparer.git
cd ExcelComparer/ExcelComparer
dotnet build -c ReleaseThe compiled executable will be in bin/Release/net10.0/
cd ExcelComparer
dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o <output-directory>ExcelComparer <file1.xlsx> <file2.xlsx> <gembox-license-key>Example:
ExcelComparer report-january.xlsx report-february.xlsx FREE-LIMITED-KEYIf you run the tool without arguments in a directory containing exactly 2 Excel files:
ExcelComparerThe tool will:
- Automatically detect the 2 Excel files in the current directory
- Prompt you for the GemBox license key
- Compare the files
If the directory contains more or fewer than 2 Excel files, an error will be displayed.
| Argument | Required | Description |
|---|---|---|
file1 |
Conditional* | Path to the first Excel file |
file2 |
Conditional* | Path to the second Excel file |
gemboxKey |
Yes | GemBox.Spreadsheet license key |
*Required only when not using auto-detection mode
The tool generates a differences.txt file in the current directory containing:
- File names being compared
- Timestamp of comparison
- Sheet-by-sheet analysis
- Number of rows and columns with values
- Cell references and values for all differences
- Summary of total differences found
Excel File Comparison Report
Generated: 2026-07-09 14:30:45
File 1: sales-q1.xlsx
File 2: sales-q2.xlsx
======================================================================
Sheet: Summary
Rows with values: File1=50, File2=50
Columns with values: File1=10, File2=10
A5: '1000' != '1200'
B5: '500' != '450'
C10: 'January' != 'February'
Total differences in sheet: 3
======================================================================
Total differences found: 3
The tool validates:
- ✓ File paths exist and are accessible
- ✓ GemBox license key is provided
- ✓ Exactly 2 Excel files when using auto-detection
- ✓ Files are valid Excel format
Errors are displayed with clear messages and the tool exits with code 1.
This tool requires a GemBox.Spreadsheet license key. You can:
- Use the FREE-LIMITED-KEY for files with up to 150 rows and 5 worksheets
- Purchase a professional license for unlimited use
- Visit: https://www.gemboxsoftware.com/spreadsheet
ExcelComparer C:\Reports\2024.xlsx C:\Reports\2025.xlsx FREE-LIMITED-KEYcd C:\Reports\Q1
# (Ensure directory contains exactly 2 Excel files)
ExcelComparer
# Enter license key when promptedExcelComparer file1.xlsx file2.xlsx FREE-LIMITED-KEY
type differences.txt- Excel 2007+ (.xlsx)
- Excel 97-2003 (.xls)
- Compares cell values only (not formatting, formulas, or charts)
- Free GemBox license has row/worksheet limitations
- Large files may require significant memory
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Created for comparing Excel files efficiently in automated workflows.