Compare two worksheets inside one Excel workbook with CMM / industrial measurement points (Name, X, Y, Z, I, J, K).
The comparison creates a new output file (original workbook is never modified) with detailed comparison results and proximity analysis.
| File | Description |
|---|---|
compare_points_gui.py |
Main entry point – Tkinter desktop GUI with workbook browser, sheet selection, tolerance settings, and live summary |
compare_points_v3.py |
Batch/config-based Python script for automation |
ComparePoints_v3.bas |
VBA module for Excel (legacy, not maintained) |
PointsCompare_Template.xlsx |
Sample workbook with measurement points |
point_compare/ |
Shared library package (schema, core logic, validators, styling, Excel I/O) |
run_point_compare_gui.batThe GUI walks you through:
- Browse workbook — select
.xlsxor.xlsm - Load sheets — populate dropdowns with available worksheet names
- Select sheets — choose original and new sheets
- Set tolerances — XYZ (mm), IJK, and close-points distance (mm)
- Run — compare and view summary
- Output — new file created:
original_name_CMP_YYYYMMDD_HHMMSS.xlsx
pip install pandas openpyxl numpy
python compare_points_v3.pyEdit CONFIG dict in the script to set workbook path, sheet names, and tolerances, then run.
A new Excel file is created with:
- Original sheet (updated) — appended result columns and new-only rows
CMP_Overview— summary counts by statusCMP_All Results— all points with status and diff columnsCMP_Match/CMP_Name Changed/CMP_Coord Changed/CMP_Replaced/CMP_Deleted/CMP_Added— filtered viewsCMP_Close Points— original/new point pairs within configurable distance (default 10 mm)CMP_Nearest Points— for each original point, its nearest new point (any distance)
The original source sheet is also updated in place with:
- Row 1 becomes a grouped label row (
Original data,Comparison status,New Data,Difference) STATUScolumn showing comparison result- Appended
Name / X / Y / Z / I / J / Kcolumns for the new-sheet values - All
*_diffcolumns showing coordinate/name changes
Layout on the original sheet:
- Original source headers move from row 1 to row 2 when needed
- Row 1 labels the sections as
Original data,Comparison status,New Data, andDifference - Any active AutoFilter is cleared before writing results; hidden rows are unhidden
- Result columns are appended after the last used source column
- Points that exist only in new sheet are appended as extra rows with
STATUS = NEW X / Y / Z / I / J / Kdisplay values use0.000formatting- Appended/group/status cells inherit the source sheet's font family
- Status colors:
MATCHlight blue/gray,NAME_CHANGED/COORD_CHANGED/REPLACED?yellow,DELETEDred,NEWorange
| Status | Meaning | Color |
|---|---|---|
MATCH |
Name and coordinates match within tolerance | Light blue |
NAME_CHANGED |
Same coordinates, different name | Yellow |
COORD_CHANGED |
Same name, different coordinates → dX/dY/dZ shown | Yellow |
REPLACED? |
Original point deleted, replaced by nearby new point (within close-points distance) | Yellow |
DELETED |
Point exists only in the original list | Red |
ADDED |
Point exists only in the new list | Orange |
On the original sheet, new-only points are shown as appended rows with STATUS = NEW.
- XYZ tolerance — coordinate matching threshold (mm)
- IJK tolerance — optional I/J/K matching threshold
- Close-points distance — threshold for REPLACED? detection (default 10 mm, independent of XYZ tolerance)
Both source sheets must contain these exact column names (case-sensitive):
NameXYZIJK
If any required column is missing, the tool shows a warning and stops.
Diff columns (X_diff, Y_diff, Z_diff, I_diff, J_diff, K_diff, NAME_diff, DIFF_Fields) are highlighted in orange bold when non-zero.
.xlsx.xlsm
pandas
openpyxl
numpy