Skip to main content

Compare two Excel files where rows have unique identifiers.

Project description

xlcompare

Compare two Excel files (old vs new) where each row has a unique ID (identifier). Ideal for comparing requirements, bill of materials, invoices, exported databases, etc. Generates differences Excel file showing changes from old to new (red strikeout for deletions, blue for insertions). Supports both .xls and .xlsx formats as inputs.

Easy To Use

Generate differences Excel file diff.xlsx with:

xlcompare old.xls new.xls

Features

  • Supports both .xls and .xlsx file formats for input files
  • Generates output Excel file containing differences (default: diff.xlsx)
  • Output is autofiltered to show differences at a glance
  • Changes in each cell are marked with red strikeout for deletions, blue for insertions
  • Deleted rows will be at the bottom in red strikeout
  • Pure Python (uses xlrd, pylightxl, XlsxWriter packages)

Excel File Format Assumptions

  • First row is assumed to contain column headings
  • Columns that are common between the two files will be compared (others are ignored)
  • Column containing unique IDs is labeled "ID" (can override with the --id option)

Limitations:

  • Only compares first sheet of each Excel file
  • Compares cells as text
  • Python 3.6 or later

Installation

python -m pip install xlcompare

Usage

usage: xlcompare [-h] [--id ID] [--outfile OUTFILE] [--colwidthmax COLWIDTHMAX] oldfile newfile

Compares Excel .xls or .xlsx files (first sheet only) with headers and unique row IDs; generates diff.xlsx.

positional arguments:
  oldfile               old Excel file
  newfile               new Excel file

optional arguments:
  -h, --help            show this help message and exit
  --id ID               ID column heading (default: ID)
  --outfile OUTFILE, -o OUTFILE
                        output .xlsx file of differences (default: diff.xlsx)
  --colwidthmax COLWIDTHMAX
                        maximum column width in output file (default: 50)

Examples

xlcompare old.xls new.xls   # Generates diff.xlsx
xlcompare old.xls new.xlsx  # Generates diff.xlsx
xlcompare old.xlsx new.xls  # Generates diff.xlsx
xlcompare old.xls new.xls -o mydiff.xlsx # Generates mydiff.xlsx
xlcompare old.xlsx new.xls --id MYID     # Uses "MYID" as the ID column

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlcompare-0.2.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

xlcompare-0.2.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file xlcompare-0.2.0.tar.gz.

File metadata

  • Download URL: xlcompare-0.2.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for xlcompare-0.2.0.tar.gz
Algorithm Hash digest
SHA256 058fdc7d9c8052f2d7ca1f058e4387ea4f0c773bb5ba0dd8ea7c84d96b8d1a1a
MD5 b1a9cc487026e76ec2b5f0f82f5b1bf5
BLAKE2b-256 4fef16ea32383dee2e8c64b8be84972813b525bbc999d5488c91b8aff3eed803

See more details on using hashes here.

File details

Details for the file xlcompare-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: xlcompare-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.1

File hashes

Hashes for xlcompare-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36bcc56a9c8c1e3ef3f1a9fd1c672d85b33db87a22c1a416e4b75ac664b81171
MD5 4bd0878abbe8c4a5678c1ec2f6ea361b
BLAKE2b-256 d2450b60cbcc8c75f40396e9016ca5de72cdccbd2e310813f6dc5c97128ab62f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page