Time for a little spring cleaning! Today we will be converting that backlog of old PPT files into more convenient PPTX. Don’t worry, this is not going to be a lengthy process as it normally would be. Rather, we will use an API that will dramatically simplify everything, allowing you to add this functionality to your project in just a few minutes.
First we shall pip install our client, as seen here:
pip install cloudmersive-convert-api-client
Now we are going to write a function call for convert_document_ppt_to_pptx, using an API instance and key. This will also need our input file.
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.ConvertDocumentApi(cloudmersive_convert_api_client.ApiClient(configuration))input_file = '/path/to/file' # file | Input file to perform the operation on.try:# Convert PowerPoint PPT (97-03) Presentation to PPTXapi_response = api_instance.convert_document_ppt_to_pptx(input_file)pprint(api_response)except ApiException as e:print("Exception when calling ConvertDocumentApi->convert_document_ppt_to_pptx: %s\n" % e)
That’s it for setup, now go ahead and run it. Boom! Your PowerPoint files have been updated! Super easy.