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

Get shape by ID

PowerPoint's UI does not display shape IDs. You must inspect the underlying Open XML.

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/slides/slide1.xml (numbering matches slide order) in a text editor.

  4. Locate the shape's <p:nvSpPr> block. The ID is the id attribute on <p:cNvPr>:

<p:spTree>
  <p:nvGrpSpPr>
    <p:cNvPr id="2" name="Textbox 1"/>
  </p:nvGrpSpPr>
  <p:sp>
    <p:nvSpPr>
      <p:cNvPr id="3" name="Chart 1"/>
    </p:nvSpPr>
  </p:sp>
</p:spTree>

This slide contains 2 shapes, with IDs 2 and 3. The name attribute is the Selection Pane name, which is your bridge between the visual editor and the XML.

Tip: In PowerPoint, open Home → Arrange → Selection Pane and rename each target shape to something unique (e.g. chart_q3_revenue). Then search the XML for that name to find its ID.

Method 2 - python-pptx

Method 3 - VBA

Run from the VBA editor (Alt+F11) and read output in the Immediate Window (Ctrl+G).

Notes

  • Shape IDs are unique per slide, not per presentation. Always pair a shape ID with its slide index.

  • IDs are stable across saves and edits, but a copy-pasted shape receives a new ID.

  • Shapes inside a group have their own IDs; the group itself also has one.

  • Placeholders from the layout carry IDs like any other shape.

Reference: shapes

Download: input.zip | output.pptx


Last updated