2023-07-22 10:00:00+00:00

For electronic component stores, customers rarely buy parts individually. Instead, they upload a Bill of Materials (BOM)—a spreadsheet containing dozens of part numbers and required quantities. Designing an engine that parses these spreadsheets and provides instant, consolidated pricing is a major competitive advantage.

Building this requires spreadsheet parsing libraries, parallel price index lookups, and asynchronous queueing for missing records.


1. Parsing Spreadsheets safely in Python

Customers upload spreadsheets in various formats (XLS, XLSX, CSV). We use libraries like openpyxl or pandas to load the data, identify the columns for part numbers and quantities using fuzzy matching, and clean up the strings:

import openpyxl

def parse_bom_file(filepath):
    wb = openpyxl.load_workbook(filepath, read_only=True)
    sheet = wb.active
    
    bom_items = []
    for row in sheet.iter_rows(values_only=True):
        # Identify and validate row data
        part_number = clean_part_number(row[0])
        quantity = int(row[1]) if row[1] else 1
        if part_number:
            bom_items.append({"part_number": part_number, "quantity": quantity})
    return bom_items

2. The Quoting Workflow

Once parsed, the system checks Elasticsearch for instant pricing. For any part number with missing or stale data (older than 24 hours), the engine writes the part to the crawl queue. Once the crawlers fetch the updates, the system calculates price breaks, adds packaging fees, and sends a completed quote PDF to the customer.

Streaming Multipart BOM Parsing & Parallel Part Resolution

Parse uploaded CSV/XLSX bills of materials as an asynchronous generator and fan out part-number pricing lookups across distributor adapters in parallel to return 500-line quotes in under 2 seconds.


About the Author — Hire Freelance Programmer Aldian Fazrihady

Aldian Fazrihady is a Top-Rated Senior Freelance Programmer, Freelance Full Stack Developer, and AI Application Engineer with 15+ years of production software engineering experience and Google Cloud Professional Cloud Architect & Data Engineer certifications. He specializes in building custom LLM & autonomous AI agents, RAG pipelines, Next.js/React PWAs, Python (Django/FastAPI), Go microservices, and serverless cloud infrastructure on Google Cloud Run and AWS.

Hire Aldian Fazrihady on Upwork | Book 1-Day Programming Service ($100 USD via Polar) | View Live AI Portfolio | Portfolio Directory | Send a Direct Message

Related Engineering Articles

Freelance Programmer Specializations & Category Hubs