I have some programming experience but I’m fairly new to Google Apps Script. I’m working on a project where I need to generate multiple Google Slides presentations automatically from data in a Google Sheets file.
What I’m trying to do
I found a working script that creates Google Documents from spreadsheet data, and it works perfectly. The script only creates new documents when the ‘File Link’ column is empty, which is exactly what I want. However, I need to adapt this to generate slide presentations instead of text documents.
When I replace the template ID with a Google Slides template and try to use SlidesApp.openById(), I get an error saying makeCopy is not a function. It seems like the Slides API works differently than the Documents API.
Question
What changes do I need to make to adapt this script for creating Google Slides presentations instead of Google Documents? I’m hoping it’s just a matter of using different methods and APIs.
Your script structure looks good - just fix the API calls. You’re mixing DriveApp and SlidesApp, but that’s actually fine. makeCopy works since it’s still a DriveApp operation. After copying, open it with SlidesApp instead of DocumentApp.
The real difference is text replacement. Documents have one body element, but Slides need you to loop through each slide and use replaceAllText instead of replaceText.
One thing I learned building similar automation - check if your template uses master slides or specific layouts. Sometimes placeholder text sits in layout elements instead of individual slides, so text replacement won’t work.
Also, SlidesApp is pickier about placeholder formatting than DocumentApp. Make sure your template markers are consistent.
had this exact problem last week! you’re mixing up the APIs. makeCopy() works fine - that’s DriveApp, not SlidesApp. after copying, open it with SlidesApp.openById() and use replaceAllText() on each slide instead of replaceText() on the document body. one thing others missed - use presentation.saveAndClose() at the end, not document.saveAndClose(), or it won’t save properly.
Everyone’s giving you code fixes, but this whole approach will bite you later. Apps Script gets messy fast when you need error handling, new features, or scaling.
I hit this exact problem generating hundreds of slide presentations for client reports. Started with Apps Script - became a maintenance nightmare.
The real solution? Automation that actually works reliably. Skip the Apps Script limitations and set up a proper workflow connecting your Sheets to Slides.
Trigger automation when new rows are added, handle errors properly, add conditional logic for different slide templates based on your data. No more debugging API differences or rate limit headaches.
You get a visual interface to modify workflows instead of digging through code every time requirements change. Way cleaner than managing template IDs and folder structures in scripts.
Bulk generation runs smoothly and you can add approval steps or notifications when presentations are ready.
The issue isn’t with makeCopy - that’s a DriveApp method that works the same for Docs and Slides. You’re trying to treat a Slides presentation like a Document after opening it, which won’t work. I’ve done this conversion before when moving training materials from docs to presentations. Here’s the key difference: Documents have one body where you use replaceText(), but Slides have multiple slide objects. You need to loop through each slide and use replaceAllText() instead. Also, SlidesApp doesn’t have anything like document.getBody() - you work with individual slide elements. One thing others missed: if your template uses master slides or layouts with placeholders, you might need to target specific text boxes instead of replacing text across all slides. This matters if you have template text that should stay unchanged on certain slides. Check your template’s slide layouts to make sure placeholder text is in editable text elements.
Main changes: Use replaceAllText() instead of replaceText(), and loop through slides to replace text on all of them.
Honestly though, Google Apps Script is a pain for this stuff. I’ve been doing similar bulk document generation and switched to Latenode because it handles Google Workspace way better. Visual interface, better error handling, and much easier to modify when things change.
makeCopy works fine with slides - just keep using DriveApp for file operations and switch to SlidesApp after creating the copy. I hit this same issue months ago while automating quarterly reports. The difference: DocumentApp uses replaceText() on the body, but SlidesApp needs replaceAllText() on each slide. If your template has multiple slides, iterate through all of them so text replacement hits everywhere. One gotcha I learned the hard way - your placeholder text needs to be in actual text boxes, not floating text elements. The replace function won’t work otherwise. Wasted hours debugging that. Your script structure looks good, just swap the API calls like the previous response mentioned. Google’s docs are pretty sparse here, so expect some trial and error.