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 major office formats, allowing users to automate complex tasks such as text extraction, form filling, and professional report generation to streamline data-heavy workflows.
Use Cases
- Automated Data Extraction: Extracting text and structured data from PDF invoices or forms for automated data entry and analysis.
- Dynamic Report Generation: Programmatically creating professional Word documents and Excel spreadsheets from raw data sources or predefined templates.
- Cross-Format Conversion: Converting documents between PDF, Excel, Word, and CSV formats to ensure compatibility across different software systems.
- Batch Document Processing: Performing bulk edits, such as updating headers, merging files, or cleaning spreadsheet data across multiple files simultaneously.
| 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. 検証(ファイル破損チェック)