This Python script automates supplier matching between:
The goal is to help prepare supplier mappings for a purchase order approval workflow.
The script performs:
Exact matching using:
CodeAccountNumberFuzzy matching using supplier names when exact code matches are not found.
The output is an Excel workbook containing:
Python 3.10+ recommended.
Install dependencies:
```bash id=”xxx” pip install pandas openpyxl rapidfuzz
---
# Input Files
Place these files in the same folder as the script:
```text id="xxx"
system1_suppliers.xlsx
system2_contacts.xlsx
supplier_matcher.py
Required columns:
CodeNameRequired columns:
AccountNumberContactNameThe script loads:
using pandas.
The script automatically removes:
from Excel column names.
Supplier codes are normalized by:
Example:
```text id=”xxx” abc123 → ABC123
This improves exact matching reliability.
---
## 4. Normalize Supplier Names
Supplier names are cleaned for fuzzy matching by:
* converting to uppercase
* removing punctuation
* removing company suffixes such as:
* LTD
* LIMITED
* PTY
* INC
* LLC
* COMPANY
* CO
Example:
```text id="xxx"
ABC Paper Pty Ltd → ABC PAPER
This improves fuzzy name comparison accuracy.
The script first attempts to match suppliers using:
```text id=”xxx” System 1 Code == System 2 AccountNumber
Exact matches are stored separately.
---
## 6. Fuzzy Matching
For suppliers that do not match by code:
* supplier names are compared using RapidFuzz
* fuzzy similarity scoring is applied
* only matches with a score >= 80 are included
Example:
```text id="xxx"
ABC PAPER
ABC PAPER SUPPLIES
may still match successfully.
The script generates:
```text id=”xxx” supplier_matching_output.xlsx
Containing 3 worksheets:
---
## Exact Matches
Suppliers successfully matched by code.
---
## Unmatched
Suppliers with no exact match found.
---
## Fuzzy Suggestions
Possible supplier matches based on name similarity.
Includes:
* System 1 supplier code
* System 1 supplier name
* Suggested System 2 account number
* Suggested System 2 contact name
* Match confidence score
---
# Running the Script
Run from terminal:
```bash id="xxx"
python supplier_matcher.py
python id="xxx"
if score >= 80:
Higher values = stricter matching.
Potential enhancements: