Docx pptx extraction
Skill cxcscmu/SkillLearnBench/skills/b1-one-shot-claude-opus-4-6/organize-messy-files/docx-pptx-extraction
Extract text from DOCX and PPTX files using python-docx and python-pptx for content analysis.From its SKILL.md
npx -y skills add cxcscmu/SkillLearnBench --skill docx-pptx-extractionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
SKILL.md
0.9 KB, 192 tokens by cl100k_base, as published. Nobody here has run it
DOCX and PPTX Text Extraction
DOCX Extraction
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
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
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.