π« The Pain Point
You have a Master Budget file with 50 sheets (one for each department). You need to email each department ONLY their own sheet. Manually saving 50 times? No.
π Agentic Solution
Divider: Bursts the workbook into independent files.
Key Features:
- Naming: Files are named
[SheetName].xlsx. - Formatting: Preserves the data structure.
βοΈ Phase 1: Commander (Quick Fix)
For a quick burst.
Prompt:
βRead
Master.xlsx. Iterate through every sheet and save it as a separate Excel file using the sheet name as the filename.β
Result: A folder of files.
ποΈ Phase 2: Architect (Permanent Tool)
For Accountants.
Engineering Prompt:
**Role:** Python Excel Dev
**Task:** Create an "Excel Sheet Splitter".
**Requirements:**
1. **GUI:**
* Select Input Excel.
* Select Output Folder.
* "Split All" button.
2. **Logic:**
* Load Excel (`sheet_name=None` gets all sheets).
* Loop dict items.
* Save each DataFrame to `.xlsx`.
* *Tip:* Use `openpyxl` engine if preserving cell colors/styles is required.
3. **Deliverables:** `sheet_split.py`, `run.bat` (Windows), `run.sh` (Mac).
π§ Prompt Decoding
- Format vs Speed: Pandas is fast but strips colors. Openpyxl is slower but keeps colors. The prompt engineer knows this tradeoff and can specify the right tool for the job.
π οΈ Instructions
- Copy Prompt -> Paste -> Run.
- Select File -> Split.