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.

Stay up to date

Follow me via email to receive actionable tips and other exclusive content. I'll also send you notifications when I publish new content.
By signing up you agree to the Privacy Policy & Terms.

Have feedback for me?

I'd appreciate any feedback you can give me regarding this post.

Was it useful? Are there any errors or was something confusing? Would you like me to write a post about a related topic? Any other feedback is also welcome. Thank you so much!