Automate PowerPoint Slides Creation with Python

Boost your Productivity with an Automated Tool for the Creation of Supply Chain Operational PowerPoint Reports with Python.

Need Help?
Subscribed! Error
Automate PowerPoint Slides Creation with Python

You are a distribution planning manager in the logistics department of a fashion retail company.

To perform analysis, you connect to the warehouse management system to extract and process data using an automated Python tool.

However, you have to manually add these visuals to slides for your weekly operational reviews.

Objective

In this article, we will build a solution to automatically create PowerPoint slides with visuals and comments.

💌 New articles straight to your inbox for free: Newsletter

Have a look at the video version of this article,

Problem Statement

Scenario

You are part of the distribution planning team of an international clothing retailer with stores on all continents.

A flowchart illustrating the supply chain process for a clothing retailer. It shows the factory producing goods and sending replenishment orders to the warehouse. The warehouse prepares the g
Logistics Network — (Image by Author)

Your distribution network includes several local warehouses that replenish the stores.

Monthly Operational Reviews

At the end of the month, you organise an operational review with the store managers to assess the performance of the distribution network.

To animate the discussion, you prepare some slides,

  1. Extract data from the Warehouse Management System (WMS)
  2. Process data and build visuals with Python
  3. Prepare a PowerPoint presentation

Objective

To be efficient, you would like to automate the creation of PowerPoint decks.

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
A flowchart illustrating the automated creation of PowerPoint slides for supply chain reports. It starts with 5 weeks of operational data from a warehouse management system database. SQL quer
Process in 4 steps — (Image by Author)

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
A PowerPoint slide titled “Warehouse Workload (WEEK-1)” and “Order Profile” displaying two visuals generated with Python. The left chart shows the warehouse workload per day with a bar chart,
Final Results — (Image by Author)

Solutions

Let us explore all the steps to generate your final report with Python.

A diagram illustrating the process of automating PowerPoint slide creation for supply chain workload analysis. The left side shows multiple PowerPoint slides with charts depicting warehouse w
Steps to create your operational report on PowerPoint — (Image by Author)

Data Extraction

Connect to your WMS and extract shipment records

  • Create your SQL Query to extract shipment records
  • Use pandas.read_sql_queryTo add it to to do the query
  • Results will be a pandas data frame

If you don’t have access to a WMS database, you can use the dataset shared in the GitHub repo.

Process the data

Add a column that calculates the number of lines per order using pandas.

Create the visuals

Create a simple bar plot chart that shows the number of Lines and Orders prepared per day.

Example of bar plot visual designed with python for powerpoint slides
Bar plot— (Image by Author)
A stacked bar chart titled “Split of orders by number of lines/order” showing the distribution of orders with different numbers of lines per week. The chart compares five weeks, with Week 2 h
Stacked Bar Plot — (Image by Author)

Save the charts

To add it to PowerPoint, you need to save it locally.

Add comments and insights.

You can add comments based on the chart you share that will summarise the performance of each week.

Include these comments under the visuals for more clarity.

A stacked bar chart titled “Split of orders by number of lines/order” showing the distribution of orders with different numbers of lines per week. The chart compares five weeks, with Week 2 h
Example of comments — (Image by Author)

Create the PowerPoint Decks

We will use the open-source library python-pptx to build our PowerPoint decks.

Introduction Slide

We will start with a special introduction slide at the beginning of the presentation.

A slide with a dark blue background displaying the title “WAREHOUSE WORKLOAD ANALYSIS” in large white text, followed by the subtitle “Orders/day for the last 5 weeks” in smaller white text. T
First Slide — (Image by Author)

Code

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
Structure of the slides automatically created with python-pptx
Slide Structure — (Image by Author)

Code

💡 TIPS
You can change the position of the objects by modifying the parameters of the Inches() functions.

Weekly Analysis of Order Profile

In this slide, you will use a stacked bar plot chart, and the comments will be based on the whole month scope.

Structure of the slides automatically created with python-pptx
Order Profile — (Image by Author)

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.

A preview of seven PowerPoint slides titled “Warehouse Workload Analysis” displaying the workload in terms of orders and lines over the past five weeks. The first slide introduces the analysi
PowerPoint Final — (Image by Author)
You can find the source code with dummy data here: Github

Conclusion

💡
If you have any question, feel free to ask here: Ask Your Question

With this simple example, you have a template for building your own PowerPoint automation solution.

You can now,

  • Add visuals, tables or bright visuals of PowerPoint (check the documentation)
  • Bring more insights or enrich the text with conditions

This Python script can be run locally on your computer with a single click.

You can also automate the report distribution by email using the SMTP library of Python.

For more details, you can have a look at this article I published a few weeks ago.

Automate Operational Reports Distribution in HTML Emails using Python
Automate the distribution of supply chain operational reports with visuals in HTML emails using python.

About Me

Let’s connect on LinkedIn and Twitter. I am a Supply Chain Engineer who is using data analytics to improve logistics operations and reduce costs.

If you’re looking for tailored consulting solutions to optimise your supply chain and meet sustainability goals, please contact me.

Need Help?