python excel slides code example

Example: "slide_layouts[2]" pptx python

# Create a slide for each manager
for manager in report_data.index.get_level_values(0).unique():
    slide = prs.slides.add_slide(prs.slide_layouts[2])
    title = slide.shapes.title
    title.text = "Report for {}".format(manager)
    top = Inches(1.5)
    left = Inches(0.25)
    width = Inches(9.25)
    height = Inches(5.0)
    # Flatten the pivot table by resetting the index
    # Create a table on the slide
    df_to_table(slide, report_data.xs(manager, level=0).reset_index(),
                left, top, width, height)
prs.save(output)