---
name: anthropic-pptx
description: Read, create, and edit PowerPoint presentations. Supports creating slides with text, tables, charts, images, and formatting; extracting content from existing presentations; and making targeted edits while preserving structure.
license: Complete terms in LICENSE.txt
---

# PPTX Skill

A skill for reading, creating, and editing PowerPoint (.pptx) files using python-pptx.

## Installation

```bash
pip install python-pptx
```

## Creating Presentations

```python
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR

prs = Presentation()

# Title slide
slide_layout = prs.slide_layouts[0]  # Title slide
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]
title.text = "Presentation Title"
subtitle.text = "Subtitle here"

# Content slide
slide_layout = prs.slide_layouts[1]  # Title and Content
slide = prs.slides.add_slide(slide_layout)
title = slide.shapes.title
title.text = "Slide Title"
content = slide.placeholders[1]
content.text = "Bullet point 1\nBullet point 2\nBullet point 3"

# Table slide
from pptx.util import Inches
from pptx.table import Table
slide = prs.slides.add_slide(prs.slide_layouts[5])  # Blank
left = Inches(1)
top = Inches(2)
width = Inches(8)
height = Inches(3)
table_shape = slide.shapes.add_table(4, 3, left, top, width, height)
table = table_shape.table
for i, row in enumerate(table.rows):
    for j, cell in enumerate(row.cells):
        cell.text = f"Row {i}, Col {j}"

# Image slide
slide = prs.slides.add_slide(prs.slide_layouts[6])  # Blank
slide.shapes.add_picture("image.png", Inches(1), Inches(1), width=Inches(8))

prs.save("presentation.pptx")
```

## Reading Existing Presentations

```python
from pptx import Presentation

prs = Presentation("existing.pptx")
for slide in prs.slides:
    for shape in slide.shapes:
        if hasattr(shape, "text"):
            print(f"Slide {prs.slides.index(slide) + 1}: {shape.text}")
        if shape.has_table:
            table = shape.table
            for row in table.rows:
                for cell in row.cells:
                    print(cell.text)
```

## Best Practices

- Choose appropriate slide layouts from prs.slide_layouts
- Use consistent formatting across slides
- Handle images with reasonable dimensions
- For templates, modify placeholder content rather than creating from scratch
- Use slide masters for consistent branding
