document-processing
PDF、Excel、Wordドキュメントの読み取り・作成・編集・変換。テキスト抽出、フォーム入力、レポート生成、データ変換。「PDF」「Excel」「Word」「ドキュメント」「レポート」「スプレッドシート」に関する質問で使用。
When & Why to Use This Skill
This Claude skill provides a comprehensive suite for the automated handling of PDF, Excel, and Word documents. It enables seamless reading, creation, editing, and conversion across multiple formats, streamlining workflows involving text extraction, data parsing, and professional report generation to enhance business productivity.
Use Cases
- Automated Report Generation: Create professional Word or PDF reports dynamically by populating templates with structured data.
- Data Extraction and Parsing: Extract text, tables, and specific data points from PDF files and Excel spreadsheets for analysis.
- Document Format Conversion: Convert files between different formats, such as Excel to CSV or Word to PDF, to ensure compatibility across systems.
- Batch Form Filling: Automate the process of filling out standardized forms and documents using data from JSON or databases.
- Workflow Automation: Implement end-to-end document workflows from initial file reading to final validation and output generation.
| name | document-processing |
|---|---|
| description | PDF、Excel、Wordドキュメントの読み取り・作成・編集・変換。テキスト抽出、フォーム入力、レポート生成、データ変換。「PDF」「Excel」「Word」「ドキュメント」「レポート」「スプレッドシート」に関する質問で使用。 |
ドキュメント処理
クイックスタート
PDF テキスト抽出
import pdfplumber
with pdfplumber.open("document.pdf") as pdf:
text = ""
for page in pdf.pages:
text += page.extract_text() or ""
Excel 読み込み
import pandas as pd
df = pd.read_excel("data.xlsx", sheet_name="Sheet1")
print(df.head())
Word 作成
from docx import Document
doc = Document()
doc.add_heading("タイトル", 0)
doc.add_paragraph("本文テキスト")
doc.save("output.docx")
ファイル形式別ガイド
| 形式 | 読み取り | 作成 | 編集 |
|---|---|---|---|
| pdfplumber, PyMuPDF | reportlab, fpdf2 | PyMuPDF | |
| Excel | pandas, openpyxl | pandas, openpyxl | openpyxl |
| Word | python-docx | python-docx | python-docx |
| CSV | pandas | pandas | pandas |
詳細ガイド
- PDF操作: reference/pdf.md
- Excel操作: reference/excel.md
- Word操作: reference/word.md
- データ変換: reference/conversion.md
ユーティリティスクリプト
# PDFからテキスト抽出
python scripts/extract_pdf.py input.pdf --output text.txt
# Excel→CSV変換
python scripts/excel_to_csv.py data.xlsx --sheet "Sheet1"
# Wordテンプレート埋め込み
python scripts/fill_template.py template.docx data.json output.docx
ワークフロー: ドキュメント処理
進捗チェックリスト:
- [ ] 1. 入力ファイル確認・形式判定
- [ ] 2. データ抽出/読み込み
- [ ] 3. データ処理・変換
- [ ] 4. 出力ファイル生成
- [ ] 5. 検証(ファイル破損チェック)