Skip to content

sixsixla/SmartExcelMerge

 
 

Repository files navigation

SmartExcelMerge - Smart Excel Diff for P4V

A Windows spreadsheet diff tool that understands table structure instead of treating every shifted cell as a modification.

SmartExcelMerge is based on skanmera/ExcelMerge. It keeps the lightweight Excel/CSV grid viewer and adds table-aware row and column alignment, code-diff-style presentation, destination-side editing, and a P4V workflow.

Smart diff overview

Highlights

Capability What it does
Smart table diff Matches stable column headers and row IDs so inserted rows or columns do not turn all following cells into modifications.
Code-diff presentation Shows real additions, removals, and edited cells with distinct visual states.
Multi-sheet navigation Opens the first changed sheet and highlights every changed sheet in the selectors.
Destination editing Edit cells, paste TSV, copy rows, insert rows, paste copied source rows, delete rows, then save with Ctrl+S.
P4V integration Opens P4V file revisions through a wrapper that preserves files locally and supports editable destinations.

What Changed

Smart Table Diff

  • Aligns columns by unique headers, then uses anchored matching and bounded fallback matching for ambiguous headers.
  • Aligns rows by a configured row key or an auto-detected ID/key/number-like column. Moving a keyed row does not become a delete plus add.
  • Shows real insertions, removals, and modified cells instead of marking all trailing cells as modified after a row or column insertion.
  • Reports added and removed column counts separately from modified rows and cells.
  • Aligns blank, keyless, and duplicate-key rows after stable-key matching, preventing existing empty rows from becoming false additions or removals.
  • Uses a bounded fallback path for large tables without reliable anchors, avoiding unbounded similarity work.

Multi-Sheet Diff Navigation

  • Scans same-name sheets at startup and opens the first sheet with a meaningful difference.
  • Marks every changed sheet in red in both sheet selectors, so a multi-sheet workbook can be reviewed without guessing where changes are located.
  • Keeps the source and destination sheet selections synchronized while switching sheets.

Code-Diff-Style Presentation

Visual Meaning
Green Added row or column content
Gray with /// hatch Removed row or column placeholder
Yellow A cell value was modified

The screenshot was produced from the public fixtures in docs/demo: one added row, one removed row, one added column, one removed column, and one modified cell. The ID=1005 record is also reordered to verify that a keyed row move is not treated as a remove/add pair.

Edit the Destination Side

The right-hand sheet can be edited when launched with a writable destination:

  • Edit or clear cells, paste rectangular TSV data, then save with Ctrl+S or Save.
  • Copy selected cells as TSV/CSV.
  • Copy a complete source row, insert blank rows above or below, insert the copied row below the selection, or delete selected destination rows.
  • Save writes back to the original destination file after creating a local backup; discard restores the working copy.

Destination edit commands

Build

Requirements:

  • Windows
  • Visual Studio 2022 or MSBuild with .NET Framework 4.8 targeting packs
& "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" `
  "ExcelMerge.GUI\ExcelMerge.GUI.csproj" `
  /p:Configuration=Release /p:Platform=AnyCPU

The GUI output is written to ExcelMerge.GUI\bin\Release\ExcelMerge.GUI.exe.

P4V Integration

The source for the P4V launcher is in tools/P4VWrapper. Build it with:

& "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" `
  "tools\P4VWrapper\ExcelMergeP4VDiff.csproj" `
  /p:Configuration=Release

Place the built files in this layout:

excel-smart-diff/
  app/ExcelMerge.GUI.exe
  p4v-diff/ExcelMergeP4VDiff.exe

In P4V, associate xls, xlsx, xlsm, csv, and tsv with p4v-diff/ExcelMergeP4VDiff.exe using these arguments:

%1 %2 --open

The wrapper copies P4V's short-lived diff files to %LOCALAPPDATA%\ExcelSmartDiff\p4v-diff\cache, removes cache folders older than three days, and limits retained cache sessions. It launches editable diffs for .xls and .xlsx destination files.

Test Fixtures

Run the GUI with these files to reproduce the screenshot and expected summary: Modified Cells(1), Modified Rows(1), Added Rows(1), Removed Rows(1), Added Columns(1), and Removed Columns(1).

Upstream and License

This is a fork-derived project. It retains the original ExcelMerge copyright notice and is distributed under the MIT License. It is not affiliated with the upstream author.

About

GUI Diff Tool for Excel,better show, like code diff

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%