# DOCX PPTX Extraction

> Extract text from DOCX and PPTX files using python-docx and python-pptx for content analysis.

- Skill: `cxcscmu/docx-pptx-extraction` (Agent Skill)
- Install (CLI): `npx get-skill add cxcscmu/docx-pptx-extraction`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cxcscmu/docx-pptx-extraction/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Docs & Writing
- Author: cxcscmu (https://skillmd.com/u/cxcscmu)
- Updated: 2026-11-24
- Page: https://skillmd.com/skills/cxcscmu/docx-pptx-extraction

---


# DOCX and PPTX Text Extraction

## DOCX Extraction

```python
from docx import Document

def extract_docx_text(filepath, max_paragraphs=50):
    doc = Document(filepath)
    text = "\n".join(p.text for p in doc.paragraphs[:max_paragraphs])
    return text
```

## PPTX Extraction

```python
from pptx import Presentation

def extract_pptx_text(filepath, max_slides=5):
    prs = Presentation(filepath)
    text = ""
    for i, slide in enumerate(prs.slides[:max_slides]):
        for shape in slide.shapes:
            if shape.has_text_frame:
                text += shape.text_frame.text + "\n"
    return text
```

## Tips
- DOCX paragraphs include headings and body text
- PPTX text is in shapes within slides
- Always wrap in try/except for robustness

