Python, how to insert value in Powerpoint template?
<p>I want to use an existing powerpoint presentation to generate a series of reports:</p>

<p>In my imagination the powerpoint slides will have content in such or similar form:</p>

<pre><code>Date of report: {{report_date}} 
Number of Sales: {{no_sales}}
...
</code></pre>

<p>Then my python app opens the powerpoint, fills in the values for this report and saves the report with a new name.
I googled, but could not find a solution for this.</p>

<p>There is python-pptx out there, but this is all about creating a new presentation and not inserting values in a template.</p>

<p>Can anybody advice?</p>

<p>You can definitely do what you want with python-pptx, just perhaps not as straightforwardly as you imagine.</p>

<p>You can read the objects in a presentation, including the slides and the shapes on the slides. So if you wanted to change the text of the second shape on the second slide, you could do it like this:</p>

<pre><code>slide = prs.slides[1]
shape = slide.shapes[1]
shape.text = 'foobar'
</code></pre>

<p>The only real question is how you find the shape you're interested in. If you can make non-visual changes to the presentation (template), you can determine the shape id or shape name and use that. Or you could fetch the text for each shape and use regular expressions to find your keyword/replacement bits.</p>

<p>It's not without its challenges, and python-pptx doesn't have features specifically designed for this role, but based on the parameters of your question, this is definitely a doable thing.</p>

python powerpoint