> For the complete documentation index, see [llms.txt](https://docs.powerpointgeneratorapi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.powerpointgeneratorapi.com/examples/slide/repeat-template-slides-by-id.md).

# Repeat template slides by 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:

```xml
<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

```python
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):

```vb
Sub ListSlideIDs()
    Dim sld As Slide
    For Each sld In ActivePresentation.Slides
        Debug.Print "Position " & sld.SlideIndex & _
                    ": slide_id=" & sld.SlideID & _
                    " (" & sld.Name & ")"
    Next sld
End Sub
```

To get the ID of just the slide currently selected:

```vb
Sub CurrentSlideID()
    MsgBox ActiveWindow.View.Slide.SlideID
End Sub
```

Reference: [slides](/json-template-syntax/slides.md)

Download: [input.zip](https://drive.google.com/uc?export=download\&id=1zA8cXcsD5A-wkk29CzUfyUX_vgc3QgLI) | [output.pptx](https://drive.google.com/uc?export=download\&id=1ybUoTvnijzpmq0CUFgLw8IuvmvGGKrhG)

{% columns %}
{% column width="41.66666666666667%" %}

<figure><img src="/files/kU41yjuOCWd1XHKxhGmt" alt=""><figcaption></figcaption></figure>

***

<figure><img src="/files/y3C5i2pD2Zz7IhRnMvvp" alt=""><figcaption></figcaption></figure>
{% endcolumn %}

{% column width="58.33333333333333%" %}
{% code lineNumbers="true" %}

```json
{
  "presentation": {
    "template": "template.pptx",
    "slides": [
      {
        "slide_id": 265
      }
    ]
  }
}
```

{% endcode %}
{% endcolumn %}
{% endcolumns %}
