Insert images from Google Drive into Google Slides using Apps Script

In this tutorial, I'll show you how easy it is to programmatically insert images from Google Drive into a Google Slides presentation using Apps Script.

In fact, this is so easy to do that the Apps Script code is just a few lines long!

Here is the code to get an image from Drive an insert it into a Google Slides presentation:

function insertImageFromDrive() {

  // Load the image from Google Drive
  var image = DriveApp.getFileById("<DRIVE_FILE_ID>");

  // Load the Google Slides presentation.
  var presentation = SlidesApp.openById("<SLIDES_ID>");

  // Insert the image into the first slide of your presentation.
  presentation.getSlides()[0].insertImage(image);
}

When you run the insertImageFromDrive() function, the image will be inserted into the first slide in your presentation.

Conclusion

In this tutorial, I showed you how easy it is to insert images from Google Drive into a Google Slides presentation using Apps Script.

Sign up to be notified when I publish new content

By signing up you agree to the Privacy Policy & Terms.