Replace Text Automatically and Prevent Certain Text | Slides Automation

Learn how to automate text replacement in Google Slides and prevent specific text from appearing repeatedly using a custom script. This tutorial walks you through the process step-by-step, ensuring you can implement this automation easily.

here's how you can replace text automatically and possibly prevent certain text from showing up in your slides over and over again so we've created an automation I'm going to show you this script line by line but first let me show you how it works we're going to go to automations menu which is something we've created and I'll show you how that works as well click replace text we're going to replace the word title with the word something click okay and every page now has that change let me show you how this works and how you can get it click on extensions appscript now I'm going to walk through this automation but you can get this at bet sheets. c/s slides this along with a bunch of other awesome slide automations are available totally for free get the slide get the automations copy and paste this directly into your slides let me walk through this the first function we have is an onopen function this merely creates a menu that allows the user to see the word replace text when they click on that they're going to run the function replace text let's see that function here's a function replace text we're going to get the UI here uh the UI just allows us to create a prompt and we're going to create two prompts one which is f and gets the word that we're going to search for and the second prompt asks what are what are you going to replace it with and we're going to use the variable replace with now the action that it does is this text range. repace all text search for this text replace it with this but how do you get this text range we're going to go to every single slide which we're going to get through slides app.get active presentation. getet slides and then for each one we're going to go to that particular slide get every single shape which is all of the text boxes and we're going to get the text of every single text box well actually of every single shape and for each one of those if there is a text range meaning we get the text we're going to do this replacement now why did I say you could prevent certain text because we're going to edit this script right now so that we can run it as a trigger so automations need two things one they need a function which is this to run and a trigger to trigger but when that trigger triggers when it happens we're not going to be there to prompt it so we're going to have to create another function in order to basically have the words that we want to replace so first off I'm going to add an item just so that we have access to it in this menu the first part of this add item is going to be what the user sees so we're going to replace title with something that's literally the words we're going to do and we're going to call this function replace title something actually we'll call it with something now this merely adds the item to our menu so back on our slide this automations menu is going to have that second item we need to save it and reopen the slide for it to happen but I want to actually get this working first so we're going to copy this replace text function bring it up here we're going to call it replace title with something we do not need the UI we do not need actually we do need the search for so we're just going to replace this with title just text in a quote and replace with we're also going to replace with something the word something now everything else is going to work exactly the same we just said hey instead of asking for the word search for here it is instead of asking what are we going to replace with here it is so this is much simpler version of this we're going to hit command s or contrl s or this save project to drive button up here once this orange doc goes away we know it is saved we can close this and what we're going to do is refresh the slide we can close it reopen it I'm going to also take this and rename it title rename it title and in our automations menu up here next to help we now have replaced title with something if I click this what happens well it's going to replace every word title with something how do we actually prevent certain text what we can do is run this function the exact same thing as clicking on it but let Google slide and Google servers run it automatically all the time so let's go to extensions appscript and do that we're going to create a trigger we already have our function created replace title with something over on the left side we need to go to our triggers menu here on the bottom right we're going to click add trigger choose which function to run that'll be replace title with something and select Event Source we're going to do time driven select every minute click save and now we have our trigger which is going to trigger the function we've created and this will happen automatically if we want to ever delete this let me show you how to get there we go to extensions appscript go on the left side triggers here on the right side next to this trigger there is three dots click on that and click delete trigger that allows you to delete the trigger if you have any errors however and you want to fix those you don't have to delete the trigger to fix the errors we can just go over to our editor and fix anything we have if you want to see past errors you can go to executions on the left all of this is covered in master spreadsheet automation course it's on you to me or spreadsheet automation 101 which is on better sheets. go take those courses it's a really awesome deep course that goes deep into all kinds of app script on sheets but it's going to help you here with slides because sheets you can do way more and on slides you can only do a few different triggers get this exact automation over at better sheets. c/s slides totally free just download it Zer enjoy and subscribe here on YouTube

automations copy and paste this directly into your slides let me walk through this the first function we have is an onopen function this merely creates a menu that allows the user to see the word replace text when they click on that they're going to run the function replace text let's see that function here's a function replace text we're going to get the UI here uh the UI just allows us to create a prompt and we're going to create two prompts one which is f and gets the word that we're going to search for and the second prompt asks what are what are you going to replace it with and we're going to use the variable replace with now the action that it does is this text range . repace all text search for this text replace it with this but how do you get this text Automatically Clear Content | Refresh Reuse Recycle Templates How to Spin Content Automatically Replace Words in Google Sheets

range we're going to go to every single slide which we're going to get through slides app.get active presentation. getet slides and then for each one we're going to go to that particular slide get every single shape which is all of the text boxes and we're going to get the text of every single text box well actually of every single shape and for each one of those if there is a text range meaning we get the text we're going to do this replacement now why did I say you could prevent certain text because we're going to edit this script right now so that we can run it as a trigger so automations need two things one they need a function which is this to run and a trigger to trigger but when that Apps Script you need to know while using ChatGPT

trigger triggers when it happens we're not going to be there to prompt it so we're going to have to create another function in order to basically have the words that we want to replace so first off I'm going to add an item just so that we have access to it in this menu the first part of this add item is going to be what the user sees so we're going to replace title with something that's literally the words we're going to do and we're going to call this function replace title something actually we'll call it with something now this merely adds the item to our menu so back on our slide this automations menu is going to have that second item we need to save it and Automatically Clear Content | Refresh Reuse Recycle Templates Mood, Food, Tude Weight Loss Tracker

reopen the slide for it to happen but I want to actually get this working first so we're going to copy this replace text function bring it up here we're going to call it replace title with something we do not need the UI we do not need actually we do need the search for so we're just going to replace this with title just text in a quote and replace with we're also going to replace with something the word something now everything else is going to work exactly the same we just said hey instead of asking for the word search for here it is instead of asking what are we going to replace with here it is so this is much simpler version of this we're going to hit command s or contrl s or this How To Replace First Word | Great for SEO keyword research

save project to drive button up here once this orange doc goes away we know it is saved we can close this and what we're going to do is refresh the slide we can close it reopen it I'm going to also take this and rename it title rename it title and in our automations menu up here next to help we now have replaced title with something if I click this what happens well it's going to replace every word title with something how do we actually prevent certain text what we can do is run this function the exact same thing as clicking on it but let Google slide and Google servers run it automatically all the time so let's go to extensions appscript and do that we're going to create a trigger we already have our function created Automatically Clear Content | Refresh Reuse Recycle Templates Mr Beast Renames YouTube Titles Automation is not Magic

replace title with something over on the left side we need to go to our triggers menu here on the bottom right we're going to click add trigger choose which function to run that'll be replace title with something and select Event Source we're going to do time driven select every minute click save and now we have our trigger which is going to trigger the function we've created and this will happen automatically if we want to ever delete this let me show you how to get there we go to extensions appscript go on the left side triggers here on the right side next to this trigger there is three dots click on that and click delete trigger that allows you to delete the trigger if you have any errors however and you want to fix those you don't have to delete the trigger to fix the errors we can just go over to our editor and fix anything we have if you Don't Delete My Formulas What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users Don't Delete My Formulas

want to see past errors you can go to executions on the left all of this is covered in master spreadsheet automation course it's on you to me or spreadsheet automation 101 which is on better sheets. go take those courses it's a really awesome deep course that goes deep into all kinds of app script on sheets but it's going to help you here with slides because sheets you can do way more and on slides you can only do a few different triggers get this exact automation over at better sheets. c/s slides totally free just download it Zer enjoy and subscribe here on YouTube Spreadsheet Automation for Beginners Learn Google Sheets Apps Script Introducing SheetFools Automation is not Magic

Big Year 2027 calendar: the whole year on one Google Sheet

Free 2027 calendar.

Copy it to your Google Drive.

Free. No password, no card. The sheet link shows up right here.