Generate a PowerPoint file using Azure Functions and Python

Published on
Reading time

For many years I have been involved with the Azure Sydney User Group, and even though I'm no longer the organiser I still gather updates for Azure in the prior month and prepare a PowerPoint presentation that contains them. My go-to place for the information is the Azure Updates website and I've typically just been browsing the site and manually updating an existing PowerPoint template.

Recently I reflected on the amount of time it takes for me to click through the pages and pull out the headlines, and decided this probably wasn't a great use of my time. Even though it's typically under 10 minutes to do it's still repetitive which clearly means it's the perfect candidate to automate!

I've used it for other integration in the past, so I know the updates website has an RSS feed which is perfect for automation.

Choosing an implementation approach

There are a few ways I could have built an automation, and my original intention was to use either Azure Logic Apps or Power Automate Flow and integrate into PowerPoint online in Microsoft 365. Unfortunately, it turns out there is no native PowerPoint online connector which means this approach became a no-go!

In the absence of this integration capability, I decided to turn to a code-based solution because I know there are many ways to generate Office documents through SDKs that implement the Office Open XML File Formats standard (ECMA-376).

One of the reasons I also looked at Logic Apps or Power Automate was their serverless pay-on-execution model. Keeping this in mind I turned to my trusty friend, Azure Functions. At this stage the no-brainer for me as a long-term C# developer would have been to implement a .NET-based Function, but as I've said a few times before, I'm wanting to push my skills to cover other languages, so I thought I'd have a go with Python.

Azure Functions + Python = ❤️

It turns out there is an excellent PowerPoint library for Python called python-pptx that has everything I needed, and I found a great blog and sample from Matthew Wimberly that had what I needed to read and parse an RSS feed. Now I had these two elements I needed a little bit of Functions magic to tie it together and provide a simple HTTP API I could use to generate my presentation.

The resulting Azure Function does all I need in less than 200 lines of Python code.

To run it once deployed to an Azure Function host, you can invoke it via a web browser with a URL similar to:

If the supplied date range is valid and there are updates that fall within it, you receive a simple web page with a link to a downloadable PowerPoint file held in a private Azure Storage account. The file is available for a limited period and access is provided by using a SAS-protected URL. The full documentation around how to debug, deploy and execute the Azure Function can be be found on the GitHub repository for the solution. Also, here's a sample of what you can generate.

I have deployed the solution onto a Consumption plan in Azure which means I'm not paying for idle compute, and the PowerPoint takes up so little space that my Storage Account costs will be tiny, especially given this API endpoint can't be invoked by just anyone. Finally, to save myself even more money, I have a Timer Function that once a week deletes any PowerPoint files sitting in the Storage Account, which won't be many (if any) for most of the time.

I'm pretty happy with the solution as it stands, but in future I might look to use my existing PowerPoint template as the base for the resulting presentation which means there would be even less manual work for me to do. Right now I still need to copy / paste from one PowerPoint to the other, but this is so trivial that I'm not bothered about automating it away ... just yet 😉.

Hopefully you find some inspiration in the solution here!

Happy Days! 😎

P.S. The GitHub repository with the solution is here: