Check URL Status from a Google Sheet!

Learn how to check the URL status of multiple links directly from Google Sheets using a simple custom function. This video demonstrates how to implement the function with Google Apps Script to fetch HTTP response codes effortlessly.

So you're trying to find that the URL status of a bunch of URLs. We could have three or four. We could have three or 400 perhaps. And maybe you're doing this manually, but you don't have to anymore. You take a URL, you go to some kind of HTTP status kind of checker and you can check that status and like get you a 200, a 400, a 4 0 4 or something like a 500. Like the server doesn't work. But we can do this in Google Sheets. Pretty cool, right? We can go up to Extensions app script . It's literally one line of code. So this is what you're going to see. We're gonna rename this check H TT P status, and we're gonna create a function here called check URL. We can say status here or check URL, and we're gonna get a URL inside of that function .

We also want to. Create this as a custom function . So this is like a little trick, or I don't know, not trick. Great practice is to put at custom function at the top in this comment . What this does is it allows us to auto complete when we're doing it inside our sheet, which I'll show you in a second one. We save this, but it's really one line of code we're going to return and we're gonna use URL fetch app fetch. And we need the URL. So whatever URL is coming in here, it's gonna be filled out here. So this URL could be any variable you want any text, it could be website. And then just put website here. And then at the end of the parentheses, we're going to do get response code. Make sure you have these parentheses here. Now this is going to work to some extent.

We need to put a couple of options in here just to make sure it really works. So put a comma and curly brackets. So inside the curly brackets we're gonna have a few parameters . First one is going to be follow redirects, and that's follow non-capital F and RR comma true. The other one we need. Mute. HTTP exceptions colon true. And put a comma between those. Now I can format this a little bit better, so it's a little bit easier to read. It's just gonna jump to another line. There you go. So that's all of the stuff we need. I'm just putting spaces in so it's easy to read. I'm gonna save it. And now in my sheet I can do equal sign.

Check and there it is, check URL status. And I need a website. It tells me I need a website here. So a two we're gonna use and it comes back 200. I can copy and paste this down as a formula . And there it is, 200. And this should update every 15 or so minutes. There's a quite a different. Different amount of updating between these. But you can leave this in here and see if, if this is gonna change at all, try some websites that are down. You are going to get an error sometimes. But that error is like a good thing 'cause it means the, it's not getting a 200. So like if we put a website that doesn't exist, but if Sheets Co slash ty Boo and we are gonna get a 4 0 4 there. Let's do la. That sounded weird. See, we're gonna get an error so that doesn't exist.

And it says DNS error . Let's see. Dot com. Still an error . DNS error doesn't exist. So pretty cool to be able to check if that URL even exists. Like sheets r awesome.com error . Probably doesn't exist, but sheets are awesome, right? Hope you enjoyed that. 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.