Merge PPTX Files in Python

Build cross-platform Python applications that merge, inspect, create, and convert Microsoft PowerPoint and OpenDocument presentations without installing Microsoft PowerPoint or OpenOffice.

Merge PPTX in Python

Aspose.Slides for Python via .NET is a presentation-processing library that can combine multiple PPTX files. To merge presentations, clone each slide from a source presentation into a destination presentation. The cloned slides retain their content, layouts, formatting, shapes, comments, and animations.

Merge PPTX files using Python

Open the destination and source presentations, clone each source slide into the destination presentation, and save the merged result as a PPTX file.

Python code to merge multiple PPTX files into one presentation

with slides.Presentation("presentation1.pptx") as destination_presentation:
    with slides.Presentation("presentation2.pptx") as source_presentation:
        for slide in source_presentation.slides:
            destination_presentation.slides.add_clone(slide)

    destination_presentation.save("merged.pptx", slides.export.SaveFormat.PPTX)

How to merge PPTX using Aspose.Slides for Python API

Follow these steps to merge two PPTX files into one presentation in Python.

  1. Install Aspose.Slides for Python via .NET from PyPI.

  2. Import the aspose.slides package into your Python project.

  3. Load the destination and source PPTX files with the Presentation class.

  4. Iterate through the source slides and append each one to the destination by calling add_clone .

  5. Call save with SaveFormat.PPTX to write the merged presentation to one PPTX file.