python-pptx

Release v0.6.22 (Installation)

python-pptx is a Python library for creating, reading, and updating PowerPoint (.pptx) files.

A typical use would be generating a PowerPoint presentation from dynamic content such as a database query, analytics output, or a JSON payload, perhaps in response to an HTTP request and downloading the generated PPTX file in response. It runs on any Python capable platform, including macOS and Linux, and does not require the PowerPoint application to be installed or licensed.

It can also be used to analyze PowerPoint files from a corpus, perhaps to extract search indexing text and images.

In can also be used to simply automate the production of a slide or two that would be tedious to get right by hand, which is how this all got started.

More information is available in the python-pptx documentation.

Browse examples with screenshots to get a quick idea what you can do with python-pptx.

Philosophy

python-pptx aims to broadly support the PowerPoint format (PPTX, PowerPoint 2007 and later), but its primary commitment is to be _industrial-grade_, that is, suitable for use in a commercial setting. Maintaining this robustness requires a high engineering standard which includes a comprehensive two-level (e2e + unit) testing regimen. This discipline comes at a cost in development effort/time, but we consider reliability to be an essential requirement.

Feature Support

python-pptx has the following capabilities:

  • Round-trip any Open XML presentation (.pptx file) including all its elements
  • Add slides
  • Populate text placeholders, for example to create a bullet slide
  • Add image to slide at arbitrary position and size
  • Add textbox to a slide; manipulate text font size and bold
  • Add table to a slide
  • Add auto shapes (e.g. polygons, flowchart shapes, etc.) to a slide
  • Add and manipulate column, bar, line, and pie charts
  • Access and change core document properties such as title and subject
  • And many others …

Even with all python-pptx does, the PowerPoint document format is very rich and there are still features python-pptx does not support.

New features/releases

New features are generally added via sponsorship. If there’s a new feature you need for your use case, feel free to reach out at the email address on the github.com/scanny profile page. Many of the most used features such as charts were added this way.

API Documentation