xlsx-to-python-openpyxl-limitation

Sub-skill of xlsx-to-python: openpyxl Limitation (+3).

5 stars

Best use case

xlsx-to-python-openpyxl-limitation is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of xlsx-to-python: openpyxl Limitation (+3).

Teams using xlsx-to-python-openpyxl-limitation 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

$curl -o ~/.claude/skills/openpyxl-limitation/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/data/office/xlsx-to-python/openpyxl-limitation/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/openpyxl-limitation/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How xlsx-to-python-openpyxl-limitation Compares

Feature / Agentxlsx-to-python-openpyxl-limitationStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of xlsx-to-python: openpyxl Limitation (+3).

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

# openpyxl Limitation (+3)

## openpyxl Limitation


openpyxl can *preserve* VBA with `keep_vba=True` but treats `vbaProject.bin` as an
opaque binary blob — it cannot read the VBA source code.


## oletools/olevba — VBA Source Extraction


```python
from oletools.olevba import VBA_Parser

def extract_vba_code(filepath: str) -> list[dict]:
    """Extract VBA macro source code from .xlsm/.xls files."""
    macros = []
    try:
        vba_parser = VBA_Parser(filepath)
        if vba_parser.detect_vba_macros():
            for filename, stream_path, vba_filename, vba_code in vba_parser.extract_macros():
                macros.append({
                    "filename": vba_filename,
                    "stream_path": stream_path,
                    "code": vba_code,
                    "type": _classify_vba(vba_code),
                })
        vba_parser.close()
    except Exception as exc:
        macros.append({"error": str(exc)})
    return macros

def _classify_vba(code: str) -> str:
    """Classify VBA code block type."""
    code_lower = code.lower()
    if "function " in code_lower:
        return "function"       # Custom functions called from cell formulas
    elif "sub " in code_lower:
        return "subroutine"     # Macros / event handlers
    elif "type " in code_lower:
        return "type_definition" # User-defined types
    return "module"             # Module-level code
```


## VBA → Python Translation Patterns


| VBA Pattern | Python Equivalent |
|-------------|------------------|
| `Function CalcStress(P, D, t) As Double` | `def calc_stress(p: float, d: float, t: float) -> float:` |
| `Dim x As Double` | `x: float` (type annotation) |
| `If ... Then ... ElseIf ... End If` | `if ... elif ... else:` |
| `For i = 1 To N ... Next i` | `for i in range(1, n + 1):` |
| `Do While ... Loop` | `while ...:` |
| `Application.WorksheetFunction.VLookup(...)` | `np.interp(...)` or dict lookup |
| `GoTo ErrorHandler` | `try/except` |
| `ReDim arr(1 To N)` | `arr = [0.0] * n` |
| `Cells(row, col).Value` | Function parameter or return value |


## When VBA Exists — Enhanced Extraction Flow


```
1. Detect .xlsm → extract VBA via oletools
2. Parse VBA Function/Sub signatures → Python function stubs
3. Extract formulas via openpyxl dual-pass (values + formulas)
4. Cross-reference: cell formulas that call VBA functions
5. VBA function body → Python implementation
6. Cell values → pytest assertions (same as non-macro path)
```

VBA functions are often called from cell formulas as UDFs (User Defined Functions).
When a formula like `=CalcStress(B2, B3, B4)` is found, the VBA `Function CalcStress`
provides the implementation and the cell value provides the test assertion.

Related Skills

python-import-path-mismatch-debugging

5
from vamseeachanta/workspace-hub

Diagnose and fix ModuleNotFoundError when a package is installed but imports still fail due to environment/path mismatches

python-import-path-debugging

5
from vamseeachanta/workspace-hub

Diagnose ModuleNotFoundError when a package is installed but still fails to import

python-debugpy

5
from vamseeachanta/workspace-hub

Debug Python: pdb REPL + debugpy remote (DAP).

python-project-template

5
from vamseeachanta/workspace-hub

Generate standardized Python project structure with pyproject.toml, UV environment, pytest configuration, and workspace-hub compliance. Creates production-ready project scaffolding.

xlsx-to-python

5
from vamseeachanta/workspace-hub

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

5
from vamseeachanta/workspace-hub

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

5
from vamseeachanta/workspace-hub

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.

subagent-sandbox-limitations

5
from vamseeachanta/workspace-hub

Critical limitations of delegate_task subagents — sandbox isolation prevents repo writes. Use for research/analysis only, not implementation.

mkdocs-integration-with-python-package

5
from vamseeachanta/workspace-hub

Sub-skill of mkdocs: Integration with Python Package (+2).

raycast-alfred-4-alfred-workflows-python

5
from vamseeachanta/workspace-hub

Sub-skill of raycast-alfred: 4. Alfred Workflows - Python.

windmill-1-python-scripts

5
from vamseeachanta/workspace-hub

Sub-skill of windmill: 1. Python Scripts.

aqwa-batch-execution-python-subprocess-pattern

5
from vamseeachanta/workspace-hub

Sub-skill of aqwa-batch-execution: Python Subprocess Pattern.