Skip to content
// Slides · Drive · Apps Script

Export each slide as a PNG in Google Slides.

Export every slide to PNG files in a new Drive folder with Apps Script. Test a short deck first, inspect the images and use a manual PNG download when you only need one slide.

“I want to save every slide in my Google Slides deck as a PNG file in Drive, without downloading the deck manually.”

The script

copy · paste · trigger
exportSlidesAsPng.gs
Apps Script
// Exports every slide as a PNG into a Drive folder named after the deck.
// Requires: Extensions > Apps Script > Services > Slides API (v1) enabled.
function exportSlidesAsPng() {
  var pres = SlidesApp.getActivePresentation();
  var presId = pres.getId();
  var folderName = pres.getName() + ' - PNG exports';
  var folder = DriveApp.createFolder(folderName);
  var slides = pres.getSlides();

  for (var i = 0; i < slides.length; i++) {
    var pageId = slides[i].getObjectId();
    var thumb = Slides.Presentations.Pages.getThumbnail(
      presId,
      pageId,
      { 'thumbnailProperties.thumbnailSize': 'LARGE' }
    );
    var blob = UrlFetchApp.fetch(thumb.contentUrl).getBlob();
    blob.setName('slide-' + (i + 1) + '.png');
    folder.createFile(blob);
  }

  Logger.log('Exported ' + slides.length + ' slides to: ' + folder.getUrl());
}

Need a variant? Gnaw writes a custom version from one sentence — fields, triggers, edge cases handled.

Walkthrough

Choose manual download or a batch export

For one slide, use Google Slides' File → Download → PNG image option for the current slide. For a repeated handoff of every slide, the script requests a thumbnail for each slide and saves the returned image to Drive. The script requires the Advanced Slides service and permission to read the presentation, fetch the image and create Drive files.

Run a two-slide acceptance check

Make a fictional test deck with two visibly different slides. Open its bound Apps Script project, enable the Google Slides API under Services, paste the script and run exportSlidesAsPng. Review the authorization request before proceeding.

Open the folder URL recorded in the execution log. Confirm that slide-1.png and slide-2.png exist, correspond to the correct slide order and contain the text and graphics needed for the handoff. Inspect readability at the size your recipient will use. File creation alone does not establish that the exported images are suitable. Review who can access logs and the destination folder before using a real client deck.

Find the folder and understand reruns

DriveApp.createFolder creates the export folder in My Drive's root, not beside the presentation. To create a child folder under a chosen destination, replace that call with DriveApp.getFolderById('YOUR_FOLDER_ID').createFolder(folderName). Confirm you have access to the chosen destination.

Every run creates another folder and another set of files. This example does not update an earlier export, remove obsolete images, resume a partial run or grant sharing access. Review partial output after a failure before deciding whether to run again.

Treat export size and duration as limits to verify

Fetch each returned contentUrl in the same iteration rather than saving those URLs as durable deliverables. The URLs are temporary and tagged with the requester's account; do not publish them. Share the saved image files after review. The LARGE option requests the service's larger thumbnail size; inspect the returned dimensions instead of assuming a print resolution.

Execution time depends on the deck and service responses. Start with a small deck and inspect actual runs before attempting a large one. This example has no checkpoint or resume mechanism.

Want a custom version?

Describe your sheet and the rule you want. Gnaw writes the Apps Script — fields, triggers, edge cases — in one shot.

FAQ

4 questions
Why is Slides not defined?
Add the Google Slides API in the Apps Script editor's Services panel. The Advanced Slides service supplies the Slides global used here.
Does changing .png to .jpg convert the image?
No. Renaming a file does not change its encoded image format. Use an actual conversion workflow if JPEG is required.
Can I share the contentUrl instead of saving files?
The returned URL is temporary and tagged with the requester's account. Save and inspect the image files, then review their Drive sharing permissions separately.
Does rerunning replace the old images?
No. This script creates another folder and another set of images.
// one good script a week

Get a working Apps Script snippet in your inbox, weekly.