xlsx-to-python-openpyxl-limitation
БесплатноБез исполняемых скриптовНе проверенSub-skill of xlsx-to-python: openpyxl Limitation (+3).
от vamseeachanta★ 21 звезда на GitHubОб этом скилле
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
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.
Установить xlsx-to-python-openpyxl-limitation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл xlsx-to-python-openpyxl-limitation?
Sub-skill of xlsx-to-python: openpyxl Limitation (+3).
Как установить скилл xlsx-to-python-openpyxl-limitation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл xlsx-to-python-openpyxl-limitation запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic