Automate Excel to PowerPoint Slides Using Python: Complete python-pptx Workflow Guide

Automate Excel to PowerPoint Slides Using Python: Complete python-pptx Workflow Guide 1
⏱ 2 min read

Automating Monthly Executive PowerPoint Presentations with Python

Corporate reporting cycles often force analysts to spend days copying Excel tables, formatting metric cards, and pasting chart images into slide decks. By combining pandas, openpyxl, and python-pptx, you can build an end-to-end pipeline that ingests raw ERP data, processes financial summaries, and outputs executive-ready .pptx presentation decks in under thirty seconds.

In this article
  1. Automating Monthly Executive PowerPoint Presentations with Python
  2. Core Python Architecture Script
  3. Advantages of Programmatic Deck Generation
  4. Continue learning

Core Python Architecture Script

import pandas as pd
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor

def generate_monthly_deck(excel_path, output_pptx):
    # 1. Load Excel Data into pandas
    df = pd.read_excel(excel_path, sheet_name="KPI_Summary")
    
    # 2. Initialize presentation from company corporate template
    prs = Presentation()
    slide_layout = prs.slide_layouts[5] # Title & Content layout
    slide = prs.slides.add_slide(slide_layout)
    
    # Set Slide Title
    title = slide.shapes.title
    title.text = "Monthly Financial & Operational Highlights"
    title.text_frame.paragraphs[0].font.size = Pt(28)
    title.text_frame.paragraphs[0].font.color.rgb = RGBColor(43, 37, 32)
    
    # 3. Add Native PowerPoint Table
    rows, cols = df.shape[0] + 1, df.shape[1]
    left, top, width, height = Inches(0.8), Inches(1.8), Inches(8.4), Inches(4.5)
    table_shape = slide.shapes.add_table(rows, cols, left, top, width, height)
    table = table_shape.table
    
    # Populate Header
    for c_idx, col_name in enumerate(df.columns):
        cell = table.cell(0, c_idx)
        cell.text = str(col_name)
        cell.fill.solid()
        cell.fill.fore_color.rgb = RGBColor(228, 127, 83) # Corporate Coral
    
    # Populate Data Rows
    for r_idx, row in df.iterrows():
        for c_idx, val in enumerate(row):
            cell = table.cell(r_idx + 1, c_idx)
            cell.text = f"{val:,.2f}" if isinstance(val, (int, float)) else str(val)
            
    prs.save(output_pptx)
    print(f"Deck exported successfully to {output_pptx}")

if __name__ == "__main__":
    generate_monthly_deck("Monthly_Metrics.xlsx", "Executive_Summary.pptx")

Advantages of Programmatic Deck Generation

  • Native Slide Elements: Generates real vector PowerPoint tables and text boxes rather than fuzzy pasted screenshots.
  • Zero Human Error: Eliminates manual transposition mistakes in executive figures.
  • Instant Scalability: Generate custom slide decks for 50 regional business units with a simple batch loop.

Explore our related tutorials on Python for Excel Users and Power Automate Workflows.

Advertisement
✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong

Leave a Reply

Your email address will not be published. Required fields are marked *