Generate Screenshots of Google Slides with Google Script

The new TallTweets app uses the Google Apps Script to convert Google Apps Script into GIF images. Internally, it uses the Google Slides API for generating screenshot images of individual slides of the presentation before stitching them into a GIF.

This Google Apps Script function uses the Advanced Slides API to generate high-resolution thumbnail images of the slides and uploads the individual slides to the Google Drive of the current user.

The public URLs of screenshot images are accessible for 30 minutes post which the URLs will expire automatically. The default mime type of the thumbnail image is PNG.

function generateScreenshots(presentationId) {
  var presentation = SlidesApp.openById(presentationId);
  var baseUrl = '{presentationId}/pages/{pageObjectId}/thumbnail';
  var parameters = {
    method: 'GET',
    headers: { Authorization: 'Bearer ' + ScriptApp.getOAuthToken() },
    contentType: 'application/json',
    muteHttpExceptions: true,

  // Log URL of the main thumbnail of the deck

  // For storing the screenshot image URLs
  var screenshots = [];

  var slides = presentation.getSlides().forEach(function (slide, index) {
    var url = baseUrl.replace('{presentationId}', presentationId).replace('{pageObjectId}', slide.getObjectId());
    var response = JSON.parse(UrlFetchApp.fetch(url, parameters));

    // Upload Googel Slide image to Google Drive
    var blob = UrlFetchApp.fetch(response.contentUrl).getBlob();
    DriveApp.createFile(blob).setName('Image ' + (index + 1) + '.png');


  return screenshots;
Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory


Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.