π« The Pain Point
You are a Sales Manager with 20 staff. Monthly, each sends a report (Sales_Staff1.xlsx, Sales_Staff2.xlsxβ¦). You have to combine them into one Master file.
Copy-pasting 20 times takes 60 minutes and risking alignment errors.
π Agentic Solution
A Desktop App that aggregates files: Point it to a folder, and it combines everything.
Key Features:
- Traceability: Adds a
Source_Filecolumn so you know which row came from which employee. - Smart Skip: Ignores temporary files (
~$temp.xlsx) to prevent crashes.
βοΈ Phase 1: Commander (Quick Fix)
For quick ad-hoc merging.
Prompt:
βI have a folder βReportsβ with 20 Excel files of identical structure. Write a Python script to merge them all into
Master.xlsx. Add a column βSourceβ indicating the original filename.β
Result: A basic merge script.
ποΈ Phase 2: Architect (Permanent Tool)
For Regular Reporting.
Engineering Prompt:
**Role:** Python Data Engineer
**Task:** Create an "Excel Merge App" (GUI).
**Requirements:**
1. **GUI:**
* Select Input Folder.
* Select Output Filename.
* "Merge" button & Progress Bar.
2. **Logic:**
* Loop through `.xlsx` files using `glob`.
* Use Pandas `.concat()`.
* **Feature:** Add filename as a new column `Source_File`.
* Handle empty files gracefully.
3. **Deliverables:** `merge_app.py`, `run.bat` (Windows), `run.sh` (Mac).
π§ Prompt Decoding
- Source_File Column: The crucial feature. Without this, after merging, you have no idea who sold what. Engineers focus on Data Integrity.
π οΈ Instructions
- Copy Prompt -> Paste -> Run.
- Select Folder -> Merge.