Generate Google Slides from Google Sheets 😎

Do you spend hours creating presentations for work, classes, or client pitches? What if you could automate this process and save valuable time? In this tutorial, you'll learn how to use Google Apps Script to automatically generate Google Slides presentations using data from Google Sheets.

What is Google Apps Script?

Google Apps Script is a powerful scripting platform that integrates with Google Workspace applications. It allows you to automate tasks, create custom functions, and build applications that work seamlessly with Google products like Sheets, Docs, and Slides.

What You'll Learn

In this tutorial, you'll discover how to:

  • Create a Google Slides presentation template

  • Prepare data in Google Sheets

  • Write a simple Apps Script to populate your presentation

  • Run the script to generate your slides automatically

Let's dive in and automate your presentation creation process!

Prerequisites

4 steps to generate a Google Slides presentation template using data from a Google Sheets spreadsheet

Step 1 — Create a Google Slides presentation template

The first step is to create a Google Slides presentation to use as a template. I created a simple presentation for this tutorial that just has 2 slides: a title slide and a body slide.

Notice the curly braces around the words title, subtitle, slide1_title and slide1_body? The braces {{ }} tell us that the contents in between them are just placeholders and need to be substituted with the real content. These are called template variables.

In this tutorial, we'll be replacing these template variables with text using Apps Script.

Screenshot of a title slide in a Google Slides presentation template.Screenshot of a body slide in a Google Slides presentation template.

Step 2 — Create a Google Sheets spreadsheet and enter data corresponding to each template variable in the presentation

Open Google Sheets and enter the template variables in column A of a sheet called Data and enter the actual text you want inserted into the presentation in column B.

Screenshot of a Google Sheets spreadsheet.

Step 3 — Create an Apps Script to generate the presentation using the template and the data

First, open the Apps Script editor from Google Sheets by selecting Extensions —> Apps Script.

Then replace the code in the editor with the code below.

function fillTemplate() {

 // Id of the slides template
 // Remember to replace this with the Id of your presentation
 var PRESENTATION_ID = "<PRESENTATION_ID>";

 // Open the presentation
 var presentation = SlidesApp.openById(PRESENTATION_ID);

 // Read data from the spreadsheet
 var values = SpreadsheetApp.getActive().getDataRange().getValues();

 // Replace template variables in the presentation with values
 values.forEach(function(row) {
   var templateVariable = row[0]; // First column contains variable names
   var templateValue = row[1]; // Second column contains values
   presentation.replaceAllText(templateVariable, templateValue);
 });

}

Step 4 — Run your code to automatically replace the variables in the presentation with values coming from the spreadsheet

When you run the fillTemplate() function, the variables in your Google Slides template will be replaced with data coming from your Google Sheets spreadsheet. Isn't that awesome?

Conclusion

Congratulations! You've just learned how to harness the power of Google Apps Script to automate your presentation creation process. Let's recap what we've achieved:

  • We created a Google Slides template with placeholder variables.

  • We organized our data in a Google Sheets spreadsheet.

  • We wrote a simple yet powerful Apps Script to bridge the gap between our data and our presentation.

  • We ran the script to automatically populate our presentation with data from our spreadsheet.

This automation can save you countless hours, especially when dealing with repetitive presentations or reports. The beauty of this approach lies in its flexibility - you can easily modify the template or data to suit various needs.

Key Takeaways:

  • Apps Script is a powerful tool for automating tasks across Google Workspace.

  • With just a few lines of code, you can create significant time-saving workflows.

  • This technique can be adapted for various use cases, from business reports to educational materials.

Next Steps:

  • Experiment with different types of content in your presentations.

  • Try creating multiple slides or even multiple presentations from a single spreadsheet.

  • Explore other Apps Script capabilities, such as adding charts or images to your slides.

  • Learn about time-driven triggers to schedule your presentation generation.

Remember, automation is all about working smarter, not harder. Keep exploring, keep creating, and keep automating!

Hope you found this tutorial helpful. Thanks for reading!

Master Google Sheets Automation

Sign up to receive exclusive Automation tips and tutorials!
I'll send you actionable tips on automating tasks with Google Sheets and coding with Apps Script. You'll also be notified whenever new content is published.
PLUS: Get instant access to my Birthday Reminder Template! 🎂
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!