Skill detail
python-pptx
Direct programmatic PowerPoint creation and manipulation skill.
Inspect before use
Automated review checks relevance, not safety or endorsement. Read the source instructions before using this skill.
SKILL.md
The saved excerpt is a snapshot from review. The external source remains the complete and most current version.
---
name: python-pptx
description: Create and manipulate PowerPoint presentations programmatically. Build slide decks with layouts, shapes, charts, tables, and images. Generate data-driven presentations from templates.
version: 1.0.0
category: office-docs
type: skill
capabilities:
- presentation_creation
- slide_layouts
- shape_manipulation
- chart_generation
- table_creation
- image_insertion
- template_based_generation
- master_slide_customization
tools:
- python
- python-pptx
- Pillow
tags: [powerpoint, pptx, presentation, slides, charts, office-automation]
platforms: [windows, macos, linux]
related_skills:
- python-docx
- openpyxl
- plotly
---
# Python-pptx PowerPoint Automation Skill
## Overview
Python-pptx is a Python library for creating and updating PowerPoint (.pptx) presentations. This skill covers comprehensive patterns for presentation automation including:
- **Presentation creation** with multiple slide layouts
- **Shape manipulation** including text boxes, images, and geometric shapes
- **Chart generation** for data visualization within slides
- **Table creation** for structured data display
- **Master slide customization** for branding consistency
- **Template-based generation** for consistent presentations
- **Placeholder management** for dynamic content insertion
## When to Use This Skill
### USE when:
- Generating presentations from data automatically
- Creating standardized report presentations
- Building slide decks with consistent branding
- Automating dashboard presentations
- Creating training materials from templates
- Generating client presentations from databases
- Building presentation pipelines for regular reports
- Creating slides with charts and tables from data
- Mass-producing presentations with variable content
### DON'T USE when:
- Need real-time presentation editing (use PowerPoint)
- Creating presentations with complex animations
- Need advanced transitions (limited support)
- Require embedded videos with playback controls
- Need to preserve complex PowerPoint features
- Creating presentations from scratch without Python (use PowerPoint)
## Prerequisites
### Installation
```bash
# Basic installation
pip install python-pptx
# Using uv (recommended)
uv pip install python-pptx
# With image support
pip install python-pptx Pillow
# Full installation for charts
pip install python-pptx Pillow lxml
```
### Verify Installation
```python
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import PP_ALIGN
print("python-pptx installed successfully!")
```
## Core Capabilities
### 1. Basic Presentation Creation
```python
"""
Create a basic PowerPoint presentation with common slide types.
"""
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.dml.color import RgbColor
from pptx.enum.shapes import MSO_SHAPE
def create_basic_presentation(output_path: str) -> None:
"""Create a basic presentation with various slide types."""
# Create presentation
prs = Presentation()
# Set slide dimensions (16:9 widescreen)
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
# Slide 1: Title Slide
title_layout = prs.slide_layouts[0] # Title slide layout
slide1 = prs.slides.add_slide(title_layout)
title = slide1.shapes.title
subtitle = slide1.placeholders[1]
title.text = "Q1 2026 Business Review"
subtitle.text = "Strategic Planning and Performance Analysis"
# Format title
for paragraph in title.text_frame.paragraphs:
paragraph.font.size = Pt(44)
paragraph.font.bold = True
# Slide 2: Title and Content
bullet_layout = prs.slide_layouts[1] # Title and content
slide2 = prs.slides.add_slide(bullet_layout)
title2 = slide2.shapes.title
body2 = slide2.placeholders[1]
title2.text = "Key Highlights"
tf = body2.text_frame
tf.Read the full source on GitHub (opens external page)