Auto Capitalize in Google Sheets
Learn how to auto capitalize names in Google Sheets using formulas and Apps Script for seamless data entry. This video covers both manual and automatic methods to ensure your text is always properly formatted.
So, you want to auto capitalize in Google Sheets. And here's a situation you might want to do that. If we're writing names here and we get sort of lazy, we are just going to type in Dan and Fred, but we still want that name to be capitalized. I'm going to show you how because you could sort of do it with a sort of do it with a formula . You can say proper A2 and you can see there like, okay, cool, right? I can do it with a formula . I can also do it all at once with a formula with array formula . So a2 colon a. And that's nice. That's nice to know, right? I can just array formula proper and then put the whole range that I want to capitalize there. Now I have these. Now
I can do command C or copy and then shift commandV and that's paste values . You could also rightclick paste special values only. You could do that. But I want to show you how to do it automatically. How to do it as you type. So let's go up to extensions appscript. We're going to do is create an onedit function . We literally just type that in here. We put e here because it is an event. We don't want to type all of the word event. And we're going to use that e to figure out where we are on the sheet. So we're going to say const range equals e.t range const row equals e.trange.get row. We also know what value we're doing. Oh, we're we're getting in that
cell. So basically this unedit is going to say the moment I hit enter in a cell that's going to be the value and that's going to be that hey I edited something. So we need to know that value is equal to e do value. We also need to know I think the column. We're just going to use co for column E dot with a capital C with parenthesis and we're going to say if call is equal to one because let's say we only want to do it in the first column and double amperand row is greater than one meaning we don't want to do it in the header row . We just want to do it in the rows after. Now we're going to add curly brackets. And now we're going to do const cap is equal to whatever the value is and we're going to
get the character at zero which is the actual first letter uppercase and we're going to combine that basically that first letter with the value and if we do slice one that means taking the second character and everything to the right of it. I know this sounds crazy, right? But this is probably the hardest part, this line right here. Because now we're going to say range set value to capitalized. And we're done. So let's test this. Did it. Leah. There it goes. Fred again. There's Fred again. Google Sheets rocks. Ooh, it did both. Cool. There you go. It
can auto capitalize in Google Sheets with just this code. You're watching Better Sheets here on YouTube. You have two options here for your next video. Before you go, comment down below if you have any question whatsoever, and I'll make future videos from those questions. But for right here, right now, one of these videos could be your next Google Sheet.