Dynamically Insert Any Image In Google Slides

While Zenphi has an action that allows you to dynamically insert charts from Google Sheets in Google Slides, they currently don't have an action that allows you to insert a PNG/JPG image dynamically from Google Drive into Google Slides.

Here is the step-by-step guide on how to bypass this limitation using a single HTTP Request action and the Google Slides API:

  • Draw a Shape: In your Google Slides template, draw a standard shape (like a grey rectangle) exactly where you want your image to appear.

  • Add a Text Tag: Type a unique placeholder text inside the shape, for example: {{image_1}}.

The Google Slides API requires a direct, publicly accessible URL to fetch and download the image. So make sure that the sharing permissions are at least "Anyone with the link can view (Reader)".


Then configure the HTTP Request action with this CURL:


curl -X POST https://slides.googleapis.com/v1/presentations/YOUR_PRESENTATION_ID:batchUpdate \

-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \

-H "Content-Type: application/json" \

-d '{"requests": [{"replaceAllShapesWithImage": {"imageUrl": "https://drive.google.com/thumbnail?id=YOUR_DRIVE_FILE_ID&sz=w1600", "replaceMethod": "CENTER_INSIDE", "containsText": {"text": "{{image_1}}", "matchCase": true}}}]}'

By using the Google Drive /thumbnail endpoint with the &sz=w1600 parameter at the end of your imageUrl, you bypass Google's download safety warnings and force Google to serve a high-resolution, crisp image directly onto your slide!


Of course, replace the YOUR_PRESENTATION_ID with the file ID that holds the shape with the placeholder, and replace YOUR_DRIVE_FILE_ID with the file ID that holds the image you want to insert. The YOUR_ACCESS_TOKEN you can get using the action Redeem OAuth Token