Keep Data Hidden in Google Sheets

Learn how to keep sensitive data hidden in Google Sheets by using named ranges and custom functions in Apps Script. This video demonstrates how to create a more secure way to manage identifiers without displaying them directly in your sheets.

So let's say we have some identifier for our company, or we want to add to names, like some internal code. Now we can use equal sign and this name, and then we can do it ampersand, and we can type in maybe this particular like company code we have here. And we can do that all the way down. But what if we don't remember this code necessarily, or we just wanna enter it one place and. Put it anywhere else. So there's a couple of ways to do that. In sheets, I'm gonna create a new sheet and call this code. And in a one I'm gonna put this code and right there I'm gonna go up to the name box right above the A in the one. And I'm gonna call this code. Now I'm gonna go back to my glue sheet where I have this code.

And instead of in quotes the code, I'm gonna just write code. Actually, I'm gonna write internal code because I think code is a reserved word here. So now let's go back and instead of code, it'll be internal code. And now it'll even show it to me as a possible auto complete. And what this is doing is it's using named ranges . As sort of this code and, and getting that code and putting it here. So again, I can copy and paste this down. Same thing. But what if I want to keep this code? Not necessarily, it's super secret, but I don't wanna put it in a tab. I wanna put it somewhere else. I'm gonna go up to Extensions app script here. I'll just name this company code. I'm gonna create a function called

company code right above it. I can even do company code in all caps equals, and I'll put that code right there, that unique code, and all I wanna do is return. Company code. So it's taking this variable here and saying, Hey, just give that to me. But I wanna make this actually auto complete because this is a new function . It's a custom function , and I wanna make it so that I just have to start typing company code and it's gonna come up. So I'll put in a slash. Two asterisks and I'll do at custom function , I'll hit save. Now, if I go back to my sheet and I just type in comp equals comp, it'll start seeing, there's some other functions here, but there's also company code,

so I can use that. If I close the parentheses there as a function , that's gonna generate that code for me. So now all I have to do is instead of internal code, I do company code. It loads a moment and there it is exactly the same result, except I don't have to keep the code here in the sheets. I can keep it in app script sort of a little bit more hidden . Also, this doesn't have to be just a string . It can be a URL fetch towards maybe a outside API or A URL somewhere. It doesn't even have to be inside of your sheet in order to get that string back, that numbers or that any kind of unique identifier.

Pretty cool. I thought I showed this to you and show you a few ways to do this kind of thing, where we have some unique number that we want to have. Added somewhere, everywhere. And how we can keep that, we can keep it inside all of the cells , we can keep it inside of a a Google Sheet tab or inside of App Script . In this particular way, creating this custom function that gives us back that code. 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.