PowerPoint reports straight from Python
Created: Oct. 5, 2011 Updated: Sept. 29, 2026
One of the more interesting projects I've done recently, a generator of research reports that fills in the company's PowerPoint templates by itself.
In a research company the results end up in a presentation anyway. Someone sits there copying tables from Excel, pasting charts, fixing colours, for dozens of slides, and all over again every time the data is corrected.
The generator is written in Python and drives Excel and PowerPoint through OLE, as if someone were clicking through Office, only from code. It starts from a template deck with a few kinds of model slides.
The most interesting part is hitting the right templates. Every question type in a study has a slide type assigned, and on every slide we know which shape is the title, which is the chart and which is the footnote, so the generator takes a question, picks a template, fills it with data and moves on. A report someone used to spend a day or two on is ready in a few minutes, and when the data changes, we just run it again.
The catch is that OLE has its moods. You need Office installed, so the whole thing runs on a single Windows machine, sometimes Excel stays in the background and locks a file, sometimes PowerPoint pops up a dialog nobody clicks. A good part of the code is about making sure those processes close properly.
But it works and the reports build themselves, as long as no dialog is waiting for someone to click OK.
Update 2026
Looking at it today, a lot of that work went into fighting Office rather than into the reports themselves. Today you wouldn't need to run it at all, there are libraries that write xlsx and pptx files directly, such as openpyxl and python-pptx, so the whole thing could run on an ordinary server, with no Windows and no keeping an eye on whether Excel is hanging in the background.
And I probably wouldn't even write it from scratch, some reports like these can be put together in tools like Power BI today.
Machine-translated from Polish (original).