combine_excel
View on GitHub →🌟 Architectural Vision & System Design
The system is architected as a modular, local-first ETL (Extract, Transform, Load) pipeline. Rather than treating spreadsheet consolidation as a simple scripting task, this architecture treats Excel files as untrusted, semi-structured databases. The system is designed to handle schema drift, inconsistent formatting, and memory constraints inherent in large-scale spreadsheet processing.
[Raw Excel/CSV Sources] ──> [Ingestion & Engine Selection] ──> [Schema Alignment & Type Coercion]
│
[Consolidated Analytical Store] <── [Vectorized Deduplication] <───────┘ Core Data & System Flow
- Ingestion / Input: The pipeline scans target directories to discover and catalog source files. It dynamically selects the optimal parsing engine (e.g.,
openpyxlfor modern XML-based Excel,xlrdfor legacy formats, or optimized C-engines for CSVs) based on file metadata and size. - Processing / Logic: Business logic is executed via a vectorized transformation pipeline. The system extracts raw data, isolates structural metadata (headers, sheet names, formatting), and applies a declarative mapping schema to align disparate columns. It handles missing values (NaNs) systematically rather than destructively.
- Persistence & Caching: To prevent memory exhaustion, the pipeline utilizes a chunked streaming architecture. Consolidated data is written out incrementally to target formats (such as optimized multi-sheet Excel workbooks or parquet-ready structures), ensuring transactional integrity during the write phase.
💻 Tech Stack & Engineering Decisions
Every technology choice in this pipeline was made to balance developer velocity, execution speed, and memory safety.
- Jupyter Notebooks: Selected as the primary orchestration and exploratory data analysis (EDA) environment. It allows for interactive debugging, visual validation of data distributions, and inline documentation of transformation rules, serving as a living runbook for data operations.
- Pandas & NumPy: Chosen for their highly optimized C-implemented vectorized operations. By avoiding native Python loops for data manipulation, the pipeline achieves near-native execution speeds during complex joins, aggregations, and type coercions.
- OpenPyXL: Utilized as the low-level XML parsing engine for Excel files. It provides fine-grained control over spreadsheet cell reading, allowing the pipeline to extract raw values without executing expensive, unneeded style calculations.
⚙️ Engineering Excellence & Best Practices
This repository demonstrates production-grade data engineering practices applied to file-based data pipelines:
- Security & Privacy: The pipeline operates entirely within a local security boundary. No data is exfiltrated to external APIs. It includes sanitization steps to strip macro-enabled payloads (
.xlsmrisks) and handles sensitive PII by providing hooks for deterministic hashing/anonymization during the transformation phase. - Performance & Scaling: To mitigate the high memory overhead of Pandas (which can be 5-10x the raw file size), the pipeline implements