xlsx-to-python-research-finding-no-existing-library-does-this
Sub-skill of xlsx-to-python: Research Finding: No Existing Library Does This (+5).
Best use case
xlsx-to-python-research-finding-no-existing-library-does-this is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Sub-skill of xlsx-to-python: Research Finding: No Existing Library Does This (+5).
Teams using xlsx-to-python-research-finding-no-existing-library-does-this should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/research-finding-no-existing-library-does-this/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How xlsx-to-python-research-finding-no-existing-library-does-this Compares
| Feature / Agent | xlsx-to-python-research-finding-no-existing-library-does-this | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Sub-skill of xlsx-to-python: Research Finding: No Existing Library Does This (+5).
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Research Finding: No Existing Library Does This (+5)
## Research Finding: No Existing Library Does This
Evaluated 2026-03-16. No library — `formulas`, `pycel`, `xlcalculator`, `koala2`,
`graphedexcel`, or the AI-powered `Pyoneer` — detects repeated row patterns and
collapses them into loops. They all operate cell-by-cell.
The building block exists in **openpyxl**: `openpyxl.formula.translate.Translator`
can normalize a formula from any row back to a canonical "row 1" form. If two cells
produce the same normalized formula, they share a pattern.
## Pattern Detection: openpyxl Translator
```python
from openpyxl.formula.translate import Translator
def normalize_formula(formula: str, cell_ref: str, origin_row: int = 1) -> str:
"""Translate formula back to row-1 to create a canonical form."""
col = ''.join(c for c in cell_ref if c.isalpha())
origin = f"{col}{origin_row}"
try:
return Translator(formula, cell_ref).translate_formula(origin)
except Exception:
return formula # absolute refs won't translate
def detect_row_patterns(formulas: list[dict]) -> dict:
"""Group formulas by normalized pattern.
Returns: {normalized_formula: [{"row": N, "cell_ref": "X", ...}, ...]}
Each group with len > 1 is a loop candidate.
"""
from collections import defaultdict
patterns = defaultdict(list)
for f in formulas:
norm = normalize_formula(f["formula"], f["cell_ref"])
patterns[norm].append(f)
return dict(patterns)
```
## Code Generation: Pattern → Python
For each pattern group, emit one of:
| Group Size | Python Output |
|-----------|--------------|
| 1 cell | Single expression: `result = a1**2 + b1` |
| 2-5 cells | List comprehension or explicit assignments |
| 6+ cells | `for` loop over row range, or numpy vectorized op |
```python
def pattern_to_python(pattern_key: str, cells: list[dict], var_map: dict) -> str:
"""Generate Python code from a formula pattern group."""
expr = formula_to_python(f"={pattern_key}", var_map)
if expr is None:
return f"# MANUAL: {pattern_key} ({len(cells)} cells)"
if len(cells) == 1:
return f"result = {expr}"
# Detect row range
rows = sorted(int(c["cell_ref"].lstrip("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) for c in cells)
start, end = rows[0], rows[-1]
# Identify column variables used in the formula
return (
f"# Pattern: {pattern_key} ({len(cells)} rows)\n"
f"for i in range({start}, {end + 1}):\n"
f" result[i] = {expr} # row-indexed"
)
```
## Compression Statistics (POC Evidence)
From WRK-1247 conductor length assessment (2,699 formulas):
| Metric | Excel | Python |
|--------|-------|--------|
| Total formula instances | 2,699 | — |
| Unique patterns | 132 | ~132 functions |
| Loop-able (≥3 repetitions) | 64 patterns (2,629 cells) | 64 `for` loops |
| One-off formulas | 70 | 70 expressions |
| **Compression ratio** | — | **20x** |
97% of formulas are loop candidates.
## Translation Yield by Complexity (POC Evidence)
| Formula Type | Auto-translatable | Example |
|-------------|-------------------|---------|
| Simple arithmetic | Yes (68%) | `=E42*25.4/1000` → `e42*25.4/1000` |
| Trig / math functions | Yes | `=PI()/4*D^2` → `math.pi/4*d**2` |
| String concatenation | No | `=A1&" text"` |
| VLOOKUP/INDEX/MATCH | No — use `formulas` lib | `=VLOOKUP(A1,B:C,2)` |
| IF/IFS | No — use `formulas` lib | `=IF(A1>0,B1,C1)` |
For untranslatable formulas, use the `formulas` library to compile the workbook
into a callable `DispatchPipe`, then call it with varied inputs.
## Pipeline: Extract → Detect Patterns → Generate Python
```
1. Dual-pass load (openpyxl) → formula strings + cached values
2. Normalize formulas (Translator) → canonical row-1 forms
3. Group by pattern → {pattern: [rows]}
4. For each pattern:
a. Translate formula → Python expr → formula_to_python()
b. Determine loop/single/vectorize → based on group size
c. Generate function + test → with Excel values as assertions
5. Assemble module → one .py file per sheet
```Related Skills
library-evaluation-integration
Create evaluation scripts and integration tests for Python scientific libraries in the digitalmodel package. Follows the established pattern from fluids, ht, meshio, sectionproperties, and pygmt evaluations.
python-import-path-mismatch-debugging
Diagnose and fix ModuleNotFoundError when a package is installed but imports still fail due to environment/path mismatches
python-import-path-debugging
Diagnose ModuleNotFoundError when a package is installed but still fails to import
python-debugpy
Debug Python: pdb REPL + debugpy remote (DAP).
python-project-template
Generate standardized Python project structure with pyproject.toml, UV environment, pytest configuration, and workspace-hub compliance. Creates production-ready project scaffolding.
research-literature
Systematize research and literature gathering for engineering categories — queries doc index, capability map, and standards ledger to produce structured research briefs for calculation implementation. type: reference
research-and-literature-gathering
Systematic workflow for finding, downloading, and indexing engineering literature by domain. Covers the full lifecycle: discovery via standards ledger and doc index, web search for open-access PDFs, download script generation, PDF validation, catalogue YAML creation, and handoff to the 7-phase document-index-pipeline for indexing. Use when populating a new engineering domain with reference literature or when a WRK item requires domain-specific standards and textbooks.
xlsx-to-python
Convert Excel calculation spreadsheets to Python code — extract formulas, build dependency graphs, generate pytest tests using cell values as assertions, and produce dark-intelligence archive YAMLs.
excel-workbook-to-python-v2
Convert engineering Excel workbooks to Python code using Codex Desktop cowork on Windows. Proven superior quality vs Linux openpyxl extraction (24 vs 7 functions, 81 vs 53 tests). Validated on Ballymore jumper installation analysis.
xlsx
Excel spreadsheet toolkit for creating, reading, and manipulating .xlsx files. Supports formulas, formatting, charts, and financial modeling with industry-standard conventions. Use for data analysis, financial models, reports, and spreadsheet automation.
doc-research-download
Repeatable workflow for domain documentation research WRKs: search for freely-available references, download PDFs via shared bash lib, catalogue into knowledge/seeds/<domain>-resources.yaml. Use when starting any WRK that collects and indexes domain reference documents. type: reference
tax-e-filing-research
Guide to directly e-filing federal Form 1120 and state franchise tax returns. Covers service comparison, cost analysis, step-by-step filing procedures, and paper filing alternatives for C-Corp entities.