# Python PowerPoint libraries

Python PowerPoint libraries create, read, and edit PowerPoint presentations from code. A file library edits the PPTX format directly rather than driving an installed copy of PowerPoint through COM automation. These libraries let report generators and AI agents turn data and drafts into slide decks.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [python-pptx](#python-pptx) | 142.1M | 3.6K | Aug 2024 | MIT |
| [pywin32](#pywinthreetwo) | 19.5M | 5.6K | Jun 2026 | PSF |
| [PyPandoc](#pypandoc) | 4.5M | 1.2K | Mar 2026 | MIT |
| [comtypes](#comtypes) | 2.4M | 351 | Nov 2026 | MIT |
| [Pandoc Python Library](#pandoc) | 871.4K | 188 | Aug 2024 | MIT |
| [Aspose.Slides](#aspose-slides-for-python) | 176.8K | 12 | Nov 2026 | Proprietary |
| [Spire.Presentation](#spire-presentation) | 37.3K | 10 | Aug 2026 | Proprietary |
| [python-pptx-text-replacer](#python-pptx-text-replacer) | 13.7K | 15 | Sep 2022 | GPLv3 |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[python-pptx](#python-pptx) has the most monthly downloads in this comparison, at 142.1M.

## Capabilities

| Library | Shape object model | Slide image export |
| --- | --- | --- |
| [python-pptx](#python-pptx) | Yes | No |
| [pywin32](#pywinthreetwo) | Via plugin | Via plugin |
| [PyPandoc](#pypandoc) | No | No |
| [comtypes](#comtypes) | Via plugin | Via plugin |
| [Pandoc Python Library](#pandoc) | No | No |
| [Aspose.Slides](#aspose-slides-for-python) | Yes | Yes |
| [Spire.Presentation](#spire-presentation) | Yes | Yes |
| [python-pptx-text-replacer](#python-pptx-text-replacer) | No | No |

## Libraries

### python-pptx

[GitHub](https://github.com/scanny/python-pptx) · [PyPI](https://pypi.org/project/python-pptx) · [Docs](https://python-pptx.readthedocs.io/)

Creates, reads, and updates PowerPoint presentation files.

- Downloads / mo: 142.1M
- Stars: 3.6K
- Last release: 1.0.2
- License: MIT
- Capabilities: [From the python-pptx docs](https://python-pptx.readthedocs.io/)

**Strengths**

- **Builds slides from existing layouts.** Add slides using a presentation’s existing slide layouts.
- **Supports in-memory presentation files.** Open or save a presentation through a file-like object.

**Watch out for**

- **Expects newer PowerPoint files.** Convert legacy PPT files to PPTX before opening them.
- **Needs another tool for rendering.** Use a separate renderer for PDF or slide-image output.

```sh
pip install python-pptx
```

**camel-ai/camel** (18.0K stars)

[camel-ai/camel](https://github.com/camel-ai/camel) 

```python
def _write_pptx_file(
    self,
    file_path: Path,
    content: List[Dict[str, Any]],
    template: Optional[str] = None,
) -> None:
    r"""Write text content to a PPTX file with enhanced formatting.

    Args:
        file_path (Path): The target file path.
        content (List[Dict[str, Any]]): The content to write to the PPTX
            file. Must be a list of dictionaries where:
            - First element: Title slide with keys 'title' and 'subtitle'
            - Subsequent elements: Content slides with keys 'title', 'text'
        template (Optional[str]): The name of the template to use. If not
            provided, the default template will be used. (default: :obj:
            `None`)
    """
    from pptx import Presentation

    # Use template if provided, otherwise create new presentation
    if template is not None:
        template_path = Path(template).resolve()
        if not template_path.exists():
            logger.warning(
                f"Template file not found: {template_path}, using "
                "default template"
            )
            presentation = Presentation()
        else:
            presentation = Presentation(str(template_path))
            # Clear all existing slides by removing them from the slide
            # list
            while len(presentation.slides) > 0:
                rId = presentation.slides._sldIdLst[-1].rId
                presentation.part.drop_rel(rId)
                del presentation.slides._sldIdLst[-1]
    else:
        presentation = Presentation()

    slide_width_inch, slide_height_inch = (
        self._get_slide_width_height_inches(presentation)
    )

    # Process slides
    if content:
        # Title slide (first element)
        title_slide_data = content.pop(0) if content else {}
        title_layout = presentation.slide_layouts[0]
        title_slide = presentation.slides.add_slide(title_layout)

        # Set title and subtitle
        if title_slide.shapes.title:
            title_slide.shapes.title.text_frame.clear()
            self._format_text(
                title_slide.shapes.title.text_frame.paragraphs[0],
                title_slide_data.get("title", ""),
            )

        if len(title_slide.placeholders) > 1:
            subtitle = title_slide.placeholders[1]
            subtitle.text_frame.clear()
            self._format_text(
                subtitle.text_frame.paragraphs[0],
                title_slide_data.get("subtitle", ""),
            )

        # Content slides
        for slide_data in content:
            if not isinstance(slide_data, dict):
                continue

            # Handle different slide types
            if 'table' in slide_data:
                self._handle_table(
                    presentation,
                    slide_data,
                )
            elif 'bullet_points' in slide_data:
                if any(
                    step.startswith(STEP_BY_STEP_PROCESS_MARKER)
                    for step in slide_data['bullet_points']
                ):
                    self._handle_step_by_step_process(
                        presentation,
                        slide_data,
                        slide_width_inch,
                        slide_height_inch,
                    )
                else:
                    self._handle_default_display(
                        presentation,
                        slide_data,
                    )

    # Save the presentation
    presentation.save(str(file_path))
    logger.debug(f"Wrote PPTX to {file_path} with enhanced formatting")

```

[camel/toolkits/pptx_toolkit.py](https://github.com/camel-ai/camel/blob/c619d1fe5aa2182395d02aadddc71b818c1b6c9f/camel/toolkits/pptx_toolkit.py#L258-L355) · [More projects using python-pptx →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20python-pptx%20for%20PowerPoint%20slide%20creation%20editing%20and%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from pptx import Presentation

prs = Presentation()
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
subtitle = slide.placeholders[1]

title.text = "Hello, World!"
subtitle.text = "python-pptx was here!"

prs.save('test.pptx')

```

From [quickstart.rst](https://github.com/scanny/python-pptx/blob/master/docs/user/quickstart.rst)

### pywin32

[GitHub](https://github.com/mhammond/pywin32) · [PyPI](https://pypi.org/project/pywin32) · [Docs](https://mhammond.github.io/pywin32/)

Provides Python extensions for Windows.

- Downloads / mo: 19.5M
- Stars: 5.6K
- Last release: 312
- License: PSF
- Capabilities: [From the pywin32 docs](https://mhammond.github.io/pywin32/)

```sh
pip install pywin32
```

**Quickstart**

```python
from win32com.client import Dispatch

powerpoint = Dispatch("PowerPoint.Application")
presentation = powerpoint.Presentations.Add()

```

From [__init__.py](https://github.com/mhammond/pywin32/blob/main/com/win32com/client/__init__.py) · [Find projects using pywin32 →](https://dashboard.exa.ai/playground/search?q=pywin32%20GitHub%20projects)

### PyPandoc

[GitHub](https://github.com/JessicaTegner/pypandoc) · [PyPI](https://pypi.org/project/pypandoc)

Wraps Pandoc in a thin Python layer.

- Downloads / mo: 4.5M
- Stars: 1.2K
- Last release: 1.17
- License: MIT
- Capabilities: [From the PyPandoc docs](https://github.com/JessicaTegner/pypandoc)

```sh
pip install pypandoc
```

**vivekVells/mcp-pandoc** (588 stars)

[vivekVells/mcp-pandoc](https://github.com/vivekVells/mcp-pandoc) 

```python
async def handle_call_tool(
    name: str, arguments: dict | None
) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
    """Handle tool execution requests.

    Tools can modify server state and notify clients of changes.
    """
    if name not in ["convert-contents"]:
        raise ValueError(f"Unknown tool: {name}")

    if not arguments:
        raise ValueError("Missing arguments")

    # Extract all possible arguments
    contents = arguments.get("contents")
    input_file = arguments.get("input_file")
    output_file = arguments.get("output_file")
    output_format = arguments.get("output_format", "markdown").lower()
    input_format = arguments.get("input_format", "markdown").lower()
    # The public MCP schema uses "txt"; Pandoc names the equivalent writer "plain".
    pandoc_output_format = "plain" if output_format == "txt" else output_format
    reference_doc = arguments.get("reference_doc")
    filters = arguments.get("filters", [])
    defaults_file = arguments.get("defaults_file")

    # Validate input parameters
    if not contents and not input_file:
        raise ValueError("Either 'contents' or 'input_file' must be provided")

    # Validate reference_doc if provided
    if reference_doc:
        if output_format not in REFERENCE_DOC_FORMATS:
            raise ValueError(
                f"reference_doc is not supported for '{output_format}' output format. "
                f"Supported formats: {_join_with_and(REFERENCE_DOC_FORMATS)}"
            )
        if not os.path.exists(reference_doc):
            raise ValueError(f"Reference document not found: {reference_doc}")
        if not os.path.isfile(reference_doc):
            raise ValueError(f"Reference document is not a file: {reference_doc}")

        # Pandoc does not verify that the reference document matches the writer. A
        # mismatch is silently ignored for docx output, and produces an unreadable
        # file for odt output. Both exit 0 with no warning, so we reject it here.
        expected_extension = f".{output_format}"
        actual_extension = os.path.splitext(reference_doc)[1].lower()
        if actual_extension != expected_extension:
            raise ValueError(
                f"reference_doc must be a '{expected_extension}' file when output_format is "
                f"'{output_format}', but '{os.path.basename(reference_doc)}' was given. Pandoc "
                f"does not reject a mismatched reference document; it silently produces an "
                f"unstyled or unreadable file. Create a matching template with: "
                f"pandoc -o reference{expected_extension} "
                f"--print-default-data-file reference{expected_extension}"
            )

    # Validate defaults_file if provided
    if defaults_file:
        if not os.path.exists(defaults_file):
            raise ValueError(f"Defaults file not found: {defaults_file}")

        # Check if it's a valid YAML file and readable
        try:
            with open(defaults_file) as f:
                yaml_content = yaml.safe_load(f)

            # Validate the YAML structure
            if not isinstance(yaml_content, dict):
                raise ValueError(f"Invalid defaults file format: {defaults_file} - must be a YAML dictionary")

            # Check if the defaults file specifies an output format that conflicts with the requested format
            if 'to' in yaml_content and yaml_content['to'] != output_format:
                print(
                    f"Warning: Defaults file specifies output format '{yaml_content['to']}' "
                    f"but requested format is '{output_format}'. Using requested format."
                )

        except yaml.YAMLError as e:
            raise ValueError(f"Error parsing defaults file {defaults_file}: {str(e)}") from e
        except PermissionError as e:
            raise ValueError(f"Permission denied when reading defaults file: {defaults_file}") from e
        except Exception as e:
            raise ValueError(f"Error reading defaults file {defaults_file}: {str(e)}") from e

    # Validate the output format against the single list the schema also advertises, so
    # the runtime check and the enum cannot drift apart.
    if output_format not in OUTPUT_FORMATS:
        raise ValueError(
            f"Unsupported output format: '{output_format}'. Supported formats are: {', '.join(OUTPUT_FORMATS)}"
        )

    if input_format not in INPUT_FORMATS:
        raise ValueError(
            f"Unsupported input format: '{input_format}'. Supported input formats are: "
            f"{', '.join(INPUT_FORMATS)}. Pandoc writes some formats it cannot read, so the "
            f"input list is shorter than the output list."
        )

    # Validate output_file requirement for advanced formats
    if output_format in ADVANCED_FORMATS and not output_file:
        raise ValueError(f"output_file path is required for {output_format} format")

    # Validate filters if provided
    if filters:
        if not isinstance(filters, list):
            raise ValueError("filters parameter must be an array of strings")

        for filter_path in filters:
            if not isinstance(filter_path, str):
                raise ValueError("Each filter must be a string path")

    def resolve_filter_path(filter_path, defaults_file=None):
        """Resolve a filter path by trying multiple possible locations.

        Args:
        ----
            filter_path: The original filter path (absolute or relative)
            defaults_file: Optional path to the defaults file for context

        Returns:
        -------
            Resolved absolute path to the filter if found, or None if not found

        """
        # If it's already an absolute path, just use it
        if os.path.isabs(filter_path):
            paths = [filter_path]
        else:
            # Try multiple locations for relative paths
            paths = [
                # 1. Relative to current working directory
                os.path.abspath(filter_path),

                # 2. Relative to the defaults file directory (if provided)
                os.path.join(os.path.dirname(os.path.abspath(defaults_file)), filter_path) if defaults_file else None,

                # 3. Relative to the .pandoc/filters directory
                os.path.join(os.path.expanduser("~"), ".pandoc", "filters", os.path.basename(filter_path))
            ]
            # Remove None entries
            paths = [p for p in paths if p]

        # Try each path
        for path in paths:
            if os.path.exists(path):
                # Check if executable and try to make it executable if not
                if not os.access(path, os.X_OK):
                    try:
                        os.chmod(path, os.stat(path).st_mode | 0o111)
                        print(f"Made filter executable: {path}")
                    except Exception as e:
                        print(f"Warning: Could not make filter executable: {path} - {str(e)}")
                        continue

                print(f"Using filter: {path}")
                return path

        return None

    def validate_filters(filters, defaults_file=None):
        """Validate filter paths and ensure they exist and are executable."""
        validated_filters = []

        for filter_path in filters:
            resolved_path = resolve_filter_path(filter_path, defaults_file)
            if resolved_path:
                validated_filters.append(resolved_path)
            else:
                raise ValueError(f"Filter not found in any of the searched locations: {filter_path}")

        return validated_filters

    def format_result_info(filters=None, defaults_file=None, validated_filters=None):
        """Format filter and defaults file information for result messages."""
        filter_info = ""
        defaults_info = ""

        if filters and validated_filters:
            filter_names = [os.path.basename(f) for f in validated_filters]
            filter_info = f" with filters: {', '.join(filter_names)}"

        if defaults_file:
            defaults_basename = os.path.basename(defaults_file)
            defaults_info = f" using defaults file: {defaults_basename}"

        return filter_info, defaults_info

    try:
        # Prepare conversion arguments
        extra_args = []

        # Add defaults file if provided - ensure it's properly formatted for Pandoc
        if defaults_file:
            # Make sure the path is absolute
            defaults_file_abs = os.path.abspath(defaults_file)
            extra_args.extend(["--defaults", defaults_file_abs])

        # Set environment variables for filters
        env = os.environ.copy()
        if output_file:
            # Set PANDOC_OUTPUT_DIR to the directory of the output file
            output_dir = os.path.dirname(os.path.abspath(output_file))
            env["PANDOC_OUTPUT_DIR"] = output_dir
        else:
            output_dir = None

        # Validate filters once and reuse the result
        validated_filters = validate_filters(filters, defaults_file) if filters else []

        # Handle filter arguments
        for filter_path in validated_filters:
            extra_args.extend(["--filter", filter_path])

        # Handle PDF-specific conversion if needed
        if output_format == "pdf":
            extra_args.extend([
                "--pdf-engine=xelatex",
                "-V", "geometry:margin=1in"
            ])

        # Handle reference doc for the formats pandoc accepts --reference-doc for
        if reference_doc and output_format in REFERENCE_DOC_FORMATS:
            extra_args.extend(["--reference-doc", reference_doc])

        # No special processing needed for content

        # Convert content using pypandoc
        if input_file:
            if not os.path.exists(input_file):
                raise ValueError(f"Input file not found: {input_file}")


            if output_file:
                # Convert file to file
                converted_output = pypandoc.convert_file(
                    input_file,
                    pandoc_output_format,
                    outputfile=output_file,
                    extra_args=extra_args
                )

                # Create result message with filter and defaults information
                filter_info, defaults_info = format_result_info(filters, defaults_file, validated_filters)
                result_message = f"File successfully converted{filter_info}{defaults_info} and saved to: {output_file}"
            else:
                # Convert file to string
                converted_output = pypandoc.convert_file(
                    input_file,
                    pandoc_output_format,
                    extra_args=extra_args
                )
        else:
            # No special processing needed for content

            if output_file:
                # Convert content to file
                pypandoc.convert_text(
                    contents,
                    pandoc_output_format,
                    format=input_format,
                    outputfile=output_file,
                    extra_args=extra_args
                )

                # Create result message with filter and defaults information
                filter_info, defaults_info = format_result_info(filters, defaults_file, validated_filters)
                result_message = (
                    f"Content successfully converted{filter_info}{defaults_info} and saved to: {output_file}"
                )
            else:
                # Convert content to string
                converted_output = pypandoc.convert_text(
                    contents,
                    pandoc_output_format,
                    format=input_format,
                    extra_args=extra_args
                )

        if output_file:
            notify_with_result = result_message
        else:
            if not converted_output:
                raise ValueError("Conversion resulted in empty output")

            # Add filter and defaults information to the notification
            filter_info, defaults_info = format_result_info(filters, defaults_file, validated_filters)
            # Adjust format for inline display
            if filter_info:
                filter_info = f" (with filters: {', '.join([os.path.basename(f) for f in validated_filters])})"
            if defaults_info:
                defaults_info = f" (using defaults file: {os.path.basename(defaults_file)})"

            notify_with_result = (
                f'Following are the converted contents in {output_format} format{filter_info}{defaults_info}.\n'
                f'Ask user if they expect to save this file. If so, provide the output_file parameter with '
                f'complete path.\n'
                f'Converted Contents:\n\n{converted_output}'
            )

        return [
            types.TextContent(
                type="text",
                text=notify_with_result
            )
        ]

    except Exception as e:
        # Handle Pandoc conversion errors
        error_prefix = "Error converting"
        error_details = str(e)

        if "Filter not found" in error_details or "Filter is not executable" in error_details:
            error_prefix = "Filter error during conversion"
        elif "defaults" in error_details and defaults_file:
            error_prefix = "Defaults file error during conversion"
            # Add more context about the defaults file
            error_details += f" (defaults file: {defaults_file})"
        elif "pandoc" in error_details.lower() and "not found" in error_details.lower():
            error_prefix = "Pandoc executable not found"
            error_details = "Please ensure Pandoc is installed and available in your PATH"

        error_msg = (
            f"{error_prefix} {'file' if input_file else 'contents'} from {input_format} to "
            f"{output_format}: {error_details}"
        )
        raise ValueError(error_msg) from e

```

[src/mcp_pandoc/server.py](https://github.com/vivekVells/mcp-pandoc/blob/7df0519cd7d976d7c3be978852f6178da5a37035/src/mcp_pandoc/server.py#L188-L513) · [More projects using PyPandoc →](https://dashboard.exa.ai/playground/search?q=pypandoc%20GitHub%20projects)

**Quickstart**

```python
import pypandoc

pypandoc.convert_text("# Example\n\nContent", "pptx", format="md", outputfile="example.pptx")

```

From [__init__.py](https://github.com/JessicaTegner/pypandoc/blob/master/pypandoc/__init__.py)

### comtypes

[GitHub](https://github.com/enthought/comtypes) · [PyPI](https://pypi.org/project/comtypes) · [Docs](https://comtypes.readthedocs.io/)

Implements COM in pure Python.

- Downloads / mo: 2.4M
- Stars: 351
- Last release: 1.5.0
- License: MIT
- Capabilities: [From the comtypes docs](https://comtypes.readthedocs.io/)

```sh
pip install comtypes
```

**Quickstart**

```python
from comtypes.client import CreateObject

powerpoint = CreateObject("PowerPoint.Application")
presentation = powerpoint.Presentations.Add()

```

From [_create.py](https://github.com/enthought/comtypes/blob/main/comtypes/client/_create.py) · [Find projects using comtypes →](https://dashboard.exa.ai/playground/search?q=comtypes%20GitHub%20projects)

### Pandoc Python Library

[GitHub](https://github.com/boisgera/pandoc) · [PyPI](https://pypi.org/project/pandoc) · [Docs](https://boisgera.github.io/pandoc/)

Represents Pandoc documents in Python.

- Downloads / mo: 871.4K
- Stars: 188
- Last release: 2.4
- License: MIT
- Capabilities: [From the Pandoc Python Library docs](https://boisgera.github.io/pandoc/)

```sh
pip install pandoc
```

**Quickstart**

```python
import pandoc

document = pandoc.read("# Example\n\nContent", format="markdown")
pandoc.write(document, file="example.pptx", format="pptx")

```

From [__init__.py](https://github.com/boisgera/pandoc/blob/fab5f10f8ac08a87b480a91e0d1eaa37c468e1ac/src/pandoc/__init__.py) · [Find projects using Pandoc Python Library →](https://dashboard.exa.ai/playground/search?q=pandoc%20GitHub%20projects)

### Aspose.Slides

[GitHub](https://github.com/aspose-slides/Aspose.Slides-for-Python-via-.NET) · [PyPI](https://pypi.org/project/aspose-slides) · [Docs](https://docs.aspose.com/slides/python-net/)

Reads, edits, and renders PowerPoint and OpenDocument presentations through the commercial SDK.

- Downloads / mo: 176.8K
- Stars: 12
- Last release: 26.11.0
- License: Proprietary
- Capabilities: [From the Aspose.Slides docs](https://docs.aspose.com/slides/python-net/)

**Strengths**

- **Reads legacy presentation formats.** Open PPT files alongside newer PowerPoint and OpenDocument presentations.
- **Renders presentation previews.** Export presentations to PDF or supported image formats.

**Watch out for**

- **Unlicensed output contains watermarks.** Evaluation mode adds a watermark to every saved presentation slide.
- **Evaluation truncates extracted text.** Text read in evaluation mode is shortened and marked with a notice.

```sh
pip install aspose-slides
```

**Fergana-Labs/stash** (343 stars)

[Fergana-Labs/stash](https://github.com/Fergana-Labs/stash) 

```python
def add_text_shape(
    pres: slides.Presentation,
    slide_index: int,
    req: TextShapeRequest,
    canvas_w_px: float,
    canvas_h_px: float,
) -> int:
    slide = pres.slides[slide_index]
    slide_w_pt = float(pres.slide_size.size.width)
    slide_h_pt = float(pres.slide_size.size.height)

    x, y, w, h = _bbox_to_pt(req.bbox, canvas_w_px, canvas_h_px, slide_w_pt, slide_h_pt)
    shape = slide.shapes.add_auto_shape(slides.ShapeType.RECTANGLE, x, y, w, h)
    shape.line_format.fill_format.fill_type = slides.FillType.NO_FILL

    if req.bg_color:
        shape.fill_format.fill_type = slides.FillType.SOLID
        shape.fill_format.solid_fill_color.color = _hex_to_color(req.bg_color)
    else:
        shape.fill_format.fill_type = slides.FillType.NO_FILL

    tf = shape.text_frame
    tf.text_frame_format.autofit_type = slides.TextAutofitType.NONE
    tf.text_frame_format.wrap_text = slides.NullableBool.TRUE

    top_pad, right_pad, bottom_pad, left_pad = req.padding_px
    tf.text_frame_format.margin_top = _px_to_pt(top_pad, canvas_h_px, slide_h_pt)
    tf.text_frame_format.margin_right = _px_to_pt(right_pad, canvas_w_px, slide_w_pt)
    tf.text_frame_format.margin_bottom = _px_to_pt(bottom_pad, canvas_h_px, slide_h_pt)
    tf.text_frame_format.margin_left = _px_to_pt(left_pad, canvas_w_px, slide_w_pt)

    # Strip the default placeholder paragraph Aspose seeds in every text frame.
    while tf.paragraphs.count > 0:
        tf.paragraphs.remove_at(0)

    for para_model in req.paragraphs:
        para = _build_paragraph(para_model, canvas_h_px, slide_h_pt)
        tf.paragraphs.add(para)

    return slide.shapes.index_of(shape)

```

[powerpoint-mcp/src/builder.py](https://github.com/Fergana-Labs/stash/blob/419efb4599fdafb648c036a5f31aeee220d363a7/powerpoint-mcp/src/builder.py#L137-L176) · [More projects using Aspose.Slides →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20aspose-slides%20for%20PowerPoint%20slide%20creation%20editing%20and%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import aspose.slides as slides

# Instantiates a Presentation object that represents a presentation file
with slides.Presentation() as presentation:
    slide = presentation.slides[0]
    # Adds an autoshape with type set to line
    slide.shapes.add_auto_shape(slides.ShapeType.LINE, 50, 150, 300, 0)
    presentation.save("NewPresentation_out.pptx", slides.export.SaveFormat.PPTX)

```

From [README.md](https://github.com/aspose-slides/Aspose.Slides-for-Python-via-.NET/blob/master/README.md)

### Spire.Presentation

[GitHub](https://github.com/eiceblue/Spire.Presentation-for-Python) · [PyPI](https://pypi.org/project/Spire.Presentation) · [Docs](https://www.e-iceblue.com/Introduce/presentation-for-python.html)

Creates, edits, and converts PowerPoint presentations through the professional Python SDK.

- Downloads / mo: 37.3K
- Stars: 10
- Last release: 11.8.1
- License: Proprietary
- Capabilities: [From the Spire.Presentation docs](https://www.e-iceblue.com/Introduce/presentation-for-python.html)

**Strengths**

- **Reads older PowerPoint formats.** Open legacy PPT presentations alongside newer PPTX files.
- **Exports slide previews.** Render slides to images or export a presentation as PDF.

**Watch out for**

- **Evaluation output shows a message.** Use a temporary license to evaluate conversion without the message.

```sh
pip install Spire.Presentation
```

**elliottzheng/NotebookLM2PPT** (499 stars)

[elliottzheng/NotebookLM2PPT](https://github.com/elliottzheng/NotebookLM2PPT) 

```python
def combine_ppt_files_with_spire(source_folder, output_file, png_names=None):
    """
    使用 Spire.Presentation 合并PPT文件，每个PPT只保留第一页，并保留原始设计

    Args:
        source_folder: 源PPT文件所在的文件夹路径
        output_file: 输出的合并PPT文件路径
    """
    # 获取所有pptx文件并按字典序排序

    ppt_files = sorted([f for f in os.listdir(source_folder) if f.endswith('.pptx')])

    ppt_names = [png_name.replace(".png", ".pptx") for png_name in png_names] if png_names else None

    if not ppt_files:
        print("未找到任何PPT文件")
        return

    print(f"找到 {len(ppt_files)} 个PPT文件:")
    valid_ppt_files = []
    for idx, file in enumerate(ppt_files, 1):
        print(f"  {idx}. {file}")
        if ppt_names and file in ppt_names:
            valid_ppt_files.append(file)
    if ppt_names:
        ppt_files = valid_ppt_files
        print(f"\n根据提供的PNG名称过滤后，剩余 {len(ppt_files)} 个PPT文件:")

    # 创建主演示文稿对象，使用第一个PPT作为基础
    first_ppt_path = os.path.join(source_folder, ppt_files[0])
    main_pres = Presentation()
    main_pres.LoadFromFile(first_ppt_path)

    # 删除第一个PPT的多余页面，只保留第一页
    while main_pres.Slides.Count > 1:
        main_pres.Slides.RemoveAt(1)

    print(f"  已添加: {ppt_files[0]} (第1页)")

    # 遍历剩余的PPT文件
    for ppt_file in ppt_files[1:]:
        file_path = os.path.join(source_folder, ppt_file)

        # 加载当前PPT文件
        temp_pres = Presentation()
        temp_pres.LoadFromFile(file_path)

        if temp_pres.Slides.Count > 0:
            # 使用 AppendBySlide 方法追加第一页，保留原始设计
            main_pres.Slides.AppendBySlide(temp_pres.Slides[0])
            print(f"  已添加: {ppt_file} (第1页)")
        else:
            print(f"  跳过: {ppt_file} (无幻灯片)")

        # 释放临时演示文稿资源
        temp_pres.Dispose()

    # 保存合并后的PPT
    main_pres.SaveToFile(output_file, FileFormat.Pptx2016)
    print(f"\n合并完成！输出文件: {output_file}")
    print(f"总共合并了 {main_pres.Slides.Count} 页幻灯片")

    # 释放资源
    main_pres.Dispose()

    valid_png_names = [ppt_name.replace(".pptx", ".png") for ppt_name in ppt_files] # 返回真正存在的png names

    return valid_png_names

```

[notebooklm2ppt/utils/ppt_combiner.py](https://github.com/elliottzheng/NotebookLM2PPT/blob/c8b1991f693b1242a702b562c9c360c2b832e941/notebooklm2ppt/utils/ppt_combiner.py#L13-L80) · [More projects using Spire.Presentation →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20Spire.Presentation%20for%20PowerPoint%20slide%20creation%20editing%20and%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from spire.presentation import *

outputFile ="HelloWorld.pptx"
presentation = Presentation()
presentation.SaveToFile(outputFile, FileFormat.Pptx2010)
presentation.Dispose()

```

From [README.md](https://github.com/eiceblue/Spire.Presentation-for-Python/blob/main/README.md)

### python-pptx-text-replacer

[GitHub](https://github.com/fschaeck/python-pptx-text-replacer) · [PyPI](https://pypi.org/project/python-pptx-text-replacer)

Replaces text in PowerPoint files in PPTX format.

- Downloads / mo: 13.7K
- Stars: 15
- Last release: 0.0.6
- License: GPLv3
- Capabilities: [From the python-pptx-text-replacer docs](https://github.com/fschaeck/python-pptx-text-replacer)

```sh
pip install python-pptx-text-replacer
```

**Quickstart**

```python
from python_pptx_text_replacer import TextReplacer
replacer = TextReplacer("original.pptx", slides='',
 tables=True, charts=True, textframes=True)
replacer.replace_text( [ ('FY2021','FY2122') ] )
replacer.write_presentation_to_file("./changed.pptx")

```

From [README.md](https://pypi.org/pypi/python-pptx-text-replacer/0.0.6/json#/info/description) · [Find projects using python-pptx-text-replacer →](https://dashboard.exa.ai/playground/search?q=python-pptx-text-replacer%20GitHub%20projects)

## FAQ

### Which Python PowerPoint library should I use?

[python-pptx](#python-pptx) suits creating and editing PPTX files on any platform. [Aspose.Slides](#aspose-slides-for-python) and [Spire.Presentation](#spire-presentation) suit teams that need a commercial SDK that also renders slides as images. [pywin32](#pywinthreetwo) suits Windows machines that automate an installed copy of PowerPoint.

### What is python-pptx?

[python-pptx](#python-pptx) creates, reads, and updates PowerPoint files through slide and shape objects. It does not render slides as images.

### How do I create a PowerPoint presentation in Python?

[python-pptx](#python-pptx) builds a presentation from slide layouts and adds text boxes, pictures, and shapes to each slide before saving the file.

### Can Python convert slides to images?

[python-pptx](#python-pptx) cannot render slides. [Aspose.Slides](#aspose-slides-for-python) and [Spire.Presentation](#spire-presentation) export slide images through their own renderers. On Windows, [pywin32](#pywinthreetwo) can call the export function of an installed copy of PowerPoint.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python PowerPoint libraries python-pptx Aspose Slides FOSS Spire code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
