Skip to content

About

A .NET CLI tool for comparing two Excel files and identifying differences

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExcelComparer

A .NET CLI tool for comparing two Excel files and identifying cell-level differences.

Description

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

Requirements

Installation

Deployed Version

The tool is deployed as a single-file executable at:

R:\Development\Tools\ExcelComparer.exe

Build from source

git clone https://github.com/PsclPtrs/ExcelComparer.git
cd ExcelComparer/ExcelComparer
dotnet build -c Release

The compiled executable will be in bin/Release/net10.0/

Publish as single-file executable

cd ExcelComparer
dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o <output-directory>

Usage

Option 1: With explicit file paths

ExcelComparer <file1.xlsx> <file2.xlsx> <gembox-license-key>

Example:

ExcelComparer report-january.xlsx report-february.xlsx FREE-LIMITED-KEY

Option 2: Auto-detect files in current directory

If you run the tool without arguments in a directory containing exactly 2 Excel files:

ExcelComparer

The tool will:

  1. Automatically detect the 2 Excel files in the current directory
  2. Prompt you for the GemBox license key
  3. Compare the files

If the directory contains more or fewer than 2 Excel files, an error will be displayed.

Arguments

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

Output

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

Sample Output

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

Error Handling

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.

GemBox.Spreadsheet License

This tool requires a GemBox.Spreadsheet license key. You can:

Examples

Compare two specific files

ExcelComparer C:\Reports\2024.xlsx C:\Reports\2025.xlsx FREE-LIMITED-KEY

Compare files in current directory

cd C:\Reports\Q1
# (Ensure directory contains exactly 2 Excel files)
ExcelComparer
# Enter license key when prompted

Process comparison results

ExcelComparer file1.xlsx file2.xlsx FREE-LIMITED-KEY
type differences.txt

Supported File Formats

  • Excel 2007+ (.xlsx)
  • Excel 97-2003 (.xls)

Limitations

  • Compares cell values only (not formatting, formulas, or charts)
  • Free GemBox license has row/worksheet limitations
  • Large files may require significant memory

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the MIT License.

Author

Created for comparing Excel files efficiently in automated workflows.

About

A .NET CLI tool for comparing two Excel files and identifying differences

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages