😫 Vấn đề (The Pain Point)
Bạn có file “TongHop.xlsx” chứa 50 sheet dữ liệu của 50 tỉnh. Giờ bạn cần gửi file riêng cho từng tỉnh. Click chuột phải vào từng Sheet -> Move or Copy -> New Book -> Save. Làm 50 lần như vậy mất cả tiếng.
🚀 Giải pháp Agentic (The Solution)
Tool tự động tách từng Sheet ra thành file độc lập [TenSheet].xlsx.
Tính năng:
- Auto Naming: Tên file mới chính là tên Sheet.
- Bulk Action: Tách 100 sheet trong 5 giây.
🤖 Engineering Prompt (Copy & Paste)
**Role:** Python Excel Developer
**Task:** Create an "Excel Sheet to File Splitter".
**Requirements:**
1. **Tech Stack:** Python, `tkinter`, `pandas`, `openpyxl`.
2. **GUI:**
* Select Input Excel File.
* Select Output Folder.
* "Split" button.
3. **Logic:**
* Load Excel file (`pd.read_excel(file, sheet_name=None)` to get all sheets).
* Iterate through dictionary of DataFrames.
* For each Sheet Name, save DataFrame to `OutputFolder/[SheetName].xlsx`.
* Show progress.
4. **Deliverables:**
* `sheet_split.py`
* `run.bat`
* `requirements.txt`
**Context:** Distributing specific data segments to different teams/branches.
🧠 Giải mã Prompt
- Pandas Dictionary: Khi đọc Excel với
sheet_name=None, Pandas trả về một Dictionary chứa tất cả các Sheet. Việc tách file trở nên cực kỳ đơn giản chỉ với vòng lặpfor.
🛠️ Hướng dẫn
- Copy Prompt -> Paste -> Chạy.
- Chọn file Tổng hợp -> Split.