Automatically Replace Words in Google Sheets
Learn how to automatically replace words in Google Sheets using both the SUBSTITUTE formula and Google Apps Script for real-time editing. This video provides step-by-step instructions to enhance your spreadsheet skills.
So you wanna automatically replace a word with another word in sheets. We can do this. So we can take sheets here and replace it with spreadsheets by using formula . And we can say, hello, this is sheets and it'll change it automatically. But what if you don't want this formula ? What if you wanted to do it when somebody edits a cell and they just replaces that word right away? We're gonna use a little bit of app script . It's gonna be super simple. Follow along Extensions app script . Now we're gonna use a function called on edit. Inside of our on edit, we're gonna have an E. This is a variable. We could call this word anything we want, but.
Inside of our function , we're going to get some very interesting information like variable row equals E range . Get row so we know what row we're on. We can say if row is greater than one, meaning we're not on the header row . Now let's do something in these curly brackets we're gonna add here. We're gonna execute something which is variable word equals spreadsheet app dot get active spreadsheet . Get active range , get value, and then we're gonna take this exact text and re copy and paste it. But instead of get value, we're gonna do set value take the word replace. And we're going go from sheets, comma Google Sheets. Let's save this
we are gonna write welcome to sheets. And you see here, it replaced it, and we still have this formula over here, but it replaced it automatically if we want to make sure that it's capitalized. If we do the sheets into Google Sheets, it is capital sensitive, so we might say, this is sheets. Now I change it. It's a Google Sheets. Isn't that cool? Get the word, replace it with something else . That's automating. Replacing the word. You are watching better sheets here on YouTube. Make sure you check out this video or this video and subscribe right now to get more tips, tricks, how tos, get more out of your Google sheets than you ever have before. I'm excited to be making a ton more videos here. Ask me questions down in the comments and I will answer them in future videos.
But for right now, right here, one of these videos is gonna be your next Google sheet.