XLSM2Spec
Excel VBAを解析し仕様書を自動生成するCLIツール
概要
XLSM2Specは、ExcelファイルのVBAマクロを解析し、構造化された仕様書を自動生成します。 レガシーシステムの保守・移行プロジェクトにおいて、既存のExcelマクロの動作理解を支援します。
機能
- ✅ xls/xlsx/xlsm ファイルの読み込み
- ✅ VBAコードの抽出と解析
- ✅ モジュール・プロシージャ構造の解析
- ✅ Markdown/JSON/HTML形式での仕様書出力
インストール
pip install xlsm2spec
または開発版:
git clone https://github.com/your-org/xlsm2spec.git
cd xlsm2spec
pip install -e ".[dev]"
使い方
基本的な使い方
# Excelファイルを解析し、仕様書を標準出力に表示
xlsm2spec analyze sample.xlsm
# 仕様書をファイルに出力
xlsm2spec analyze sample.xlsm -o spec.md
# JSON形式で出力
xlsm2spec analyze sample.xlsm -o spec.json -f json
# HTML形式で出力(スタイル付き)
xlsm2spec analyze sample.xlsm -o spec.html -f html
# 詳細ログを表示
xlsm2spec analyze sample.xlsm --verbose
コマンドオプション
Usage: xlsm2spec analyze [OPTIONS] INPUT_FILE
ExcelファイルのVBAを分析し、仕様書を生成する
Arguments:
INPUT_FILE 分析するExcelファイル (.xls, .xlsx, .xlsm) [required]
Options:
-o, --output PATH 出力ファイルパス(省略時は標準出力)
-f, --format TEXT 出力形式(markdown, json, html) [default: markdown]
--verbose 詳細な出力を表示
--help Show this message and exit.
出力例
# sample.xlsm 仕様書
**生成日時**: 2025-12-12 10:00:00
## シート一覧
- Sheet1
- Sheet2
## VBAモジュール一覧
| モジュール名 | 種別 | プロシージャ数 |
|-------------|------|--------------|
| Module1 | standard | 2 |
### Module1
**種別**: standard
#### プロシージャ一覧
##### CalculateTotal
- **種別**: function
- **アクセス**: Public
- **引数**: startRow: Long, endRow: Long
- **戻り値**: Double
開発
環境構築
# 仮想環境作成
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows
# 開発版インストール
pip install -e ".[dev]"
# テスト実行
pytest
# 型チェック
mypy src/
# リンター
ruff check src/
プロジェクト構造
xlsm2spec/
├── src/xlsm2spec/
│ ├── domain/ # ドメインモデル(Workbook, Module, Procedure等)
│ ├── application/ # アプリケーションサービス(AnalyzerService)
│ ├── infrastructure/ # 外部ライブラリ統合(ExcelReader, VbaExtractor, VbaParser)
│ └── presentation/ # 出力フォーマッター(Markdown, JSON, HTML)
├── tests/ # pytest テスト
└── steering/ # MUSUBI SDD ドキュメント
アーキテクチャ
Clean Architecture(4層構造)を採用:
- Domain層: ビジネスモデル(Workbook, VbaProject, Module, Procedure)
- Application層: ユースケース(AnalyzerService)
- Infrastructure層: 外部ライブラリ統合(xlrd, openpyxl, oletools)
- Presentation層: 出力フォーマット(Markdown, JSON, HTML)
ライセンス
MIT License
貢献
Issue、Pull Requestを歓迎します。
Metadata
Release files for xlsm2spec 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| xlsm2spec-0.1.0.tar.gz | 135.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xlsm2spec-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 159.8 kB
Release files / xlsm2spec-0.1.0.tar.gz
| Download URL | xlsm2spec-0.1.0.tar.gz |
|---|---|
| Size | 135.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccf86a8b5fbd7ce06110ba1c9ea1613f4f30273417ab8c44232c5fe8be0af545
|
|
BLAKE2b-256 checksum How to use checksums |
e5b43de457d3918bd0f069b4dadc9848df45a9a7b1c166cbd11cd2c5a7ba7d47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / xlsm2spec-0.1.0-py3-none-any.whl
| Download URL | xlsm2spec-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00c0e969810df45824277263e64a90dd86092917048576af94295cb9f9a11c27
|
|
BLAKE2b-256 checksum How to use checksums |
31790a097097679c6a15d16bfef9585262faeaad302c237dd9a74d394904fb9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for xlsm2spec 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.