Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BOM Compare

Compare two Bill of Materials (BOM) files - a previous version and a latest version - and produce a styled HTML report of what changed: line items added, removed, quantity changes, and reference‑designator changes, with color‑coded highlighting.

There are two ways to use it:

File Best for
Web app bom_compare.html Drag‑and‑drop, no install, runs in any browser
Python CLI bom_compare.py Scripting / batch use

Both produce the same report.


Web app (recommended)

A single self‑contained HTML file. The Excel/CSV parser is embedded, so it runs fully offline - no server, no internet, no install.

Use it

  1. Double‑click bom_compare.html to open it in your browser.
  2. Drop the Old BOM (Previous) into the left zone and the New BOM (Latest) into the right zone (or click a zone to browse).
  3. Click Compare. The report renders on the page.
  4. Click Download Report to save a standalone bom_comparison_report.html.

Supported file formats

.xlsx, .xls, and .csv - in any combination (e.g. an old .csv vs a new .xlsx). The header row is auto‑detected, so files may have title/metadata rows above the table.

Column settings (COL_ALIASES)

The app matches columns by their header names, case‑insensitively. Open the Column Settings panel to edit the accepted header names for each field (comma‑separated):

Field Default aliases
Designator designator, reference, ref
Part Name partname, name, part name, part number, mpn
Description description, desc
Quantity quantity, qty, q
Manufacturer manufacturer, mfr, mfg
  • Save Settings - stores your aliases in the browser (persists across reloads) and downloads a settings.json.
  • Load settings.json - import an aliases file.
  • Reset to Defaults - restore the values above.

Note: the Part Name aliases also determine which row is detected as the header row, so make sure at least one matches your file's part‑name column.

Settings are saved/loaded via the buttons rather than read silently from disk - a browser security limitation for files opened directly (file://). The defaults are built in, so the app always works on its own.


Python CLI

Requires Python 3 and openpyxl (Excel .xlsx only):

pip install openpyxl
python bom_compare.py <old.xlsx> <new.xlsx> [output.html]

If run with no arguments it falls back to the default filenames defined near the bottom of the script. The column aliases are defined inline as COL_ALIASES in bom_compare.py.

Worksheet selection

For multi‑sheet workbooks, the active (last‑saved) worksheet is searched for a header row first, then the remaining sheets in workbook order. The first sheet with a valid Part Name header is used; if none has one, an error is raised.


What the report shows

  • Summary - totals for changes, added, removed, quantity changes, designator changes, and the net quantity delta.

  • Key Insights - automatic callouts (removed components, new components, designator reassignments, large quantity swings).

  • Change table - one row per change, classified as:

    • Removed - in the old BOM but not the new one
    • Added - in the new BOM but not the old one
    • Qty Changed - same part, different quantity
    • Qty + Designator Changed - quantity changed and the designator changes exceed the quantity change
    • Designator Changed - same quantity, reassigned reference designators

    Designators are color‑highlighted (red = removed, green = added, blue = changed).

Parts are matched between BOMs by Part Name.


Screenshot

Screenshot

Files

File Purpose
bom_compare.html Self‑contained web app
bom_compare.py Python CLI version
settings.json Default column aliases
bom_comparison_report.html Example generated report

About

Compare two BOM excel sheets

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages