How to split a single PowerPoint presentation PPTX into separate slides in Python

Cloudmersive
2 min readMay 20, 2020

--

Today we will be looking at splitting up multi-slide PowerPoint presentations into multiple PPTX files, each with one of the individual slides. This is going to be an absolute snap for you Python users out there. Keep reading.

The first step of our process is to pip install the Cloudmersive Convert API:

pip install cloudmersive-convert-api-client

Now we shall proceed to instance our API and then use that for calling the split_document_pptx function. This needs now an input file path, as well as optionally specifying how you would like your files.

from __future__ import print_functionimport timeimport cloudmersive_convert_api_clientfrom cloudmersive_convert_api_client.rest import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_convert_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_convert_api_client.SplitDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))input_file = '/path/to/file' # file | Input file to perform the operation on.return_document_contents = true # bool | Set to true to return the contents of each presentation directly, set to false to only return URLs to each resulting presentation.  Default is true. (optional)try:# Split a single PowerPoint Presentation PPTX into Separate Slidesapi_response = api_instance.split_document_pptx(input_file, return_document_contents=return_document_contents)pprint(api_response)except ApiException as e:print("Exception when calling SplitDocumentApi->split_document_pptx: %s\n" % e)

Simple! That’s right, it just works. So now that you don’t have to worry about splitting PPTX files, what are you going to do with all this new-found free time? You might consider looking through our documentation for the rest of this same library, as it contains all sorts of other useful methods like this one.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet