Exporting All Thumbnail Images Retrieved from Google Slides as Zip File using Google Apps Script

Gists

This is a sample script for exporting all thumbnail images retrieved from Google Slides as a zip file using Google Apps Script.

Sample script

Before you use this script, please enable Slides API at Advanced Google services. Ref

function myFunction() {
  const presentationId = "###"; // Please set Google Slides ID.
  const folderId = "###"; // Please set the folder ID.
  const outputFilename = "###"; // Please set the output filename.

  const blobs = SlidesApp.openById(presentationId)
    .getSlides()
    .map((e, i) =>
      UrlFetchApp.fetch(
        Slides.Presentations.Pages.getThumbnail(
          presentationId,
          e.getObjectId(),
          {
            "thumbnailProperties.mimeType": "PNG",
            "thumbnailProperties.thumbnailSize": "LARGE",
          }
        ).contentUrl
      )
        .getBlob()
        .setName(`page${("000" + (i + 1)).slice(-3)}.png`)
    );
  DriveApp.getFolderById(folderId).createFile(
    Utilities.zip(blobs).setName(outputFilename + ".zip")
  );
}

 Share!