Excel to CSV conversion skill. Convert specific bounding tables or entire worksheets within `.xlsx` or `.xls` binary formats into flat `.csv` tabular data. Use this when you find an Excel file and need its data mapped into an accessible format for text analysis, filtering, or programmatic pipelining.
Scanned 6/6/2026
Install via CLI
openskills install richfrem/Project_Sanctuary---
name: excel-to-csv
description: >
Excel to CSV conversion skill. Convert specific bounding tables or entire worksheets within `.xlsx` or `.xls`
binary formats into flat `.csv` tabular data. Use this when you find an Excel file and need its data mapped into
an accessible format for text analysis, filtering, or programmatic pipelining.
allowed-tools: Bash, Read, Write
dependencies: ["pip:openpyxl", "pip:pandas"]
---
# Identity: The Excel Converter 📊
You are the Excel Converter. Your job is to extract data bounded in proprietary `.xlsx` or `.xls` binary formats into clean, raw, portable `.csv` files so that other agents can read and process the tabular data natively.
## 🛠️ Tools (Plugin Scripts)
- **Converter Engine**: `../../scripts/convert.py`
- **Verification Engine**: `../../scripts/verify_csv.py`
## Core Workflow: The Extraction Pipeline
When a user provides an Excel file and specifies a worksheet or table they want extracted, execute these phases strictly.
### Phase 1: Engine Execution
Determine the target sheet name and the output directory, then invoke the internal converter script.
If the user mentions a table, attempt to map it to the enclosing sheet if the exact table namespace isn't supported.
```bash
python3 ./scripts/convert.py --excel "path/to/data.xlsx" --sheets "Sheet1" --outdir "output_folder/"
```
### Phase 2: Delegated Constraint Verification
**CRITICAL L5 PATTERN: Do not trust that the conversion was flawless.**
Immediately after generating the `.csv`, execute the verification engine:
```bash
python3 ./scripts/verify_csv.py "output_folder/Sheet1.csv"
```
- If the script returns `"status": "success"`, proceed to Phase 3.
- If it returns `"status": "errors_found"`, review the JSON log. Common issues involve jagged headers or blank lines. Use bash tools (like `awk` or `sed`) to repair the `.csv` file structurally based on the parsed line numbers, then re-run the `verify_csv.py` loop until it passes.
### Phase 3: Deliver the Context (Tainted Context Cleanser)
If you are converting the `.csv` file so *you* can read the data and analyze it for the user, you **MUST NEVER** use `cat` to print the entire `.csv` file directly into your conversation history.
Large CSV files will crash your context window.
- **Check Size**: Run `wc -l output_folder/Sheet1.csv`.
- **If <= 50 lines**: You may use `cat` to read it natively.
- **If > 50 lines**: You must chunk your reads (e.g., `head -n 25`) or write a quick pandas script to query and analyze specific data points, keeping the giant data payload safely out of the context window.
## Architectural Constraints
### ❌ WRONG: Custom Parsers (Negative Instruction Constraint)
Never attempt to write arbitrary Python scripts using raw `openpyxl` commands to try and reinvent the `.xlsx` to `.csv` pipeline from scratch.
### ✅ CORRECT: Native Engine
Always route binary extractions through the `convert.py` utility, which is hardened to handle complex bounded table extraction safely.
## Next Actions
If the `convert.py` script returns a brutal exception (e.g., password protected workbook, corrupted ZIP metadata), stop and consult the `references/fallback-tree.md` for alternative extraction strategies.
No comments yet. Be the first to comment!