For the complete documentation index, see llms.txt. This page is also available as Markdown.

Repeat template slides by ID

Easily create multiple copies of your template slides using slide id

You can repeat a template slide using the slide's unique identifier to create multiple copies as needed.

Using slide_id ensures the correct slide is referenced even if the slide order or structure changes within the template.

PowerPoint does not surface slide IDs in its user interface. To obtain one, inspect the underlying file structure.

Method 1: Unzip the file

A .pptx is a ZIP archive.

  1. Copy the file and rename the extension from .pptx to .zip.

  2. Extract it.

  3. Open ppt/_rels/presentation.xml.rels and ppt/presentation.xml.

In presentation.xml, the <p:sldIdLst> element lists every slide in presentation order:

<p:sldIdLst>
  <p:sldId id="256" r:id="rId2"/>
  <p:sldId id="257" r:id="rId3"/>
</p:sldIdLst>

The id attribute is the slide ID. The r:id maps to a relationship in presentation.xml.rels, which resolves to the actual slide part (e.g. slides/slide1.xml). Slide IDs start at 256 and are stable across reordering — the position in <p:sldIdLst> changes, the id does not.

Method 2: python-pptx

from pptx import Presentation

prs = Presentation("deck.pptx")
for index, slide in enumerate(prs.slides, start=1):
    print(f"Position {index}: slide_id={slide.slide_id}")

Method 3: VBA

Run this from the PowerPoint VBA editor (Alt+F11 → Insert → Module → F5) with the presentation open. It prints every slide's ID and position to the Immediate window (Ctrl+G):

To get the ID of just the slide currently selected:

Reference: slides

Download: input.zip | output.pptx


Last updated