M Harshit
M Harshit

Reputation: 11

Is there a way to save multiple power-point presentations with different names using a for-loop through python-pptx?

from pptx import Presentation  
prs = Presentation()  
prs.save('test2.pptx')

So I am using the above code to save a blank ppt in some location. Now if I want to save multiple ppts with names test1.ppt, test2.ppt, test3.ppt and so on, is there a way to loop it using a for-loop. Note that I am trying create multiple power-point presentations and not multiple slides in a single presentation. Really wish, the owner of pptx (@Scanny) can look into this.

Upvotes: 0

Views: 343

Answers (1)

BigBen
BigBen

Reputation: 50008

I think this is pretty straightforward:

from pptx import Presentation
prs = Presentation()
for i in Range(1, 4):
    prs.save('test{}.pptx'.format(i))

Upvotes: 1

Related Questions