Automate PowerPoint Slide Creation with Python
Boost your Productivity with an Automated Tool for the Creation of Supply Chain Operational PowerPoint Reports with Python
Do you spend more time creating PowerPoint presentations than analyzing data?
With Python, you can automate the creation of these presentations and focus on what matters — improving your logistics operations.
In this article, we’ll show you how to build an automated tool that generates PowerPoint slides with visuals and comments, giving you more time to make strategic decisions and boost your productivity.
💌 New articles straight in your inbox for free: Newsletter
📘 Boost your Productivity with Data Analytics: Productivity Cheat Sheet
If you prefer watching, have a look at the YouTube tutorial!
I. How can you create PowerPoint presentations with Python?
You are part of the distribution planning team of an international clothing retailer with stores on all continents.
To perform analysis, you connect to the warehouse management system to extract and process data using an automated tool built with Python.
However, you have to spend time manually putting these visuals in slides for your weekly operational reviews.
Your distribution network includes several local warehouses that replenish the stores.
1. Use Data to Prepare Monthly Operational Reviews
At the end of the month, you organize an operational review with the store managers to assess the performance of the distribution network.
To animate the discussion, you prepare some slides,
- Extract data from the Warehouse Management System (WMS)
- Process data and built visuals with Python
- Prepare a PowerPoint presentation
2. Our goal is to streamline the process of PowerPoint deck creation
To be efficient, you would like to automate the process of PowerPoint deck creation.
Your solution will be fully automated.
- Extract order lines of the last month from the WMS SQL database
- Process the data and compute KPIs with key insights by week
- Automatically put the visuals and insights in a PowerPoint presentation
3. Results
The final deck will have slides like the ones below:
- 5 slides with visuals of the daily workload (left) and 1 slide for the monthly analysis of the order profile (right)
- A visual generated with Python
- A comment area will provide insights based on the visual
💡 Follow me on Medium for more articles related to 🏭 Supply Chain Analytics, 🌳 Sustainability and 🕜 Productivity.
II. Process Data and Design Slides with Python
You can find the source code with dummy data here: Github
Let us explore all the steps to generate your final report.
1. Data Extraction
Connect to your WMS and extract shipment records
- Create your SQL Query to extract shipment records
- Use pandas.read_sql_query to do the query
- The results will be in a pandas data frame
If you don’t have access to a WMS database, you can use the dataset shared in the GitHub repo.
2. Process the data
Add a column that calculates the number of lines per order using pandas.
3. Create the visuals
Create a simple bar plot chart that shows the number of Lines and Orders prepared per day.
4. Save the charts
To be added to the PowerPoint, you need to save it locally.
5. Add comments and insights
You can add comments based on the chart you share that will summarize each week's performance.
Include these comments under the visuals for more clarity.
II. Create the PowerPoint Decks with Python-pptx
We will use the open-source library python-pptx to build our PowerPoint decks. For more details, have a look at the documentation.
1. Introduction Slide
We will start with a special introduction slide at the beginning of the presentation.
Code
2. Daily Analysis Slide by WEEK
The structure of your slide will always be the same
- A title on top (e.g: Warehouse Workload (WEEK-5))
- A picture at the centre of the slide
- A text box for the comment area
Code
💡 TIPS
You can change the position of the objects by modifying the parameters of Inches() functions.
3. Weekly Analysis of Order Profile
In this slide, you will use a stacked bar plot chart, and the comments will be based on the full month's scope.
Code
💡 TIPS
You can change the font size by modifying the parameter of the functions Pt().
Finally, you have a PowerPoint file with 7 slides ready for your meetings.
II. Conclusion & Next Steps
By automating the creation of PowerPoint slides with Python, you can focus on analyzing data and making strategic decisions for your business.
With the tips and techniques in this article, you can streamline your workflow and improve efficiency.
Remove Manual Tasks
This simple example gives you a template to build your PowerPoint automation solution.
You can now,
- Add visuals, tables or smart visuals of PowerPoint (check the documentation)
- Bring more insights or enrich the text with conditions
This Python script can be launched locally on your computer or deployed on a web application.
Boost your Solution with Generative AI: The Smart “GPT”
You can find in another article my explorative journey of Large Language Models (LLMs) used to improve the user experience for reporting and advanced analytics products.
The idea of this experiment is to design a smart agent equipped with a GPT model and connected to a database.
- Users ask operational questions: “Where is my shipment?”
- The agent queries the database and extracts the results.
- The agent replies with a proper answer.
After OpenAI introduced ChatGPT's advanced features, we can take the opportunity to deploy solutions like this PowerPoint automation script in a custom GPT.
Users would upload data, and the agent would prepare the Powerpoint.
You can get inspiration from the Supply Chain Analyst”, a custom GPT agent I’ve designed to automate supply chain analytics tasks and interact with users using natural language.
💡 For more details,
Automate Email Reporting
You can also automate the report distribution by email using the SMTP library of Python.
Indeed, a simple Python script deployed on the cloud will automatically perform these four steps:
- Extract prepared order lines of last week from the WMS SQL database
- Process the data and compute KPIs with key insights
- Automatically send an HTML email with visuals and comments
Have a look at this article I published a few weeks ago,
About Me
Let’s connect on Linkedin and Twitter; I am a Supply Chain Engineer using data analytics to improve logistics operations and reduce costs.
If you are interested in Data Analytics and Supply Chain, look at my website.