August 20, 2022

Check HTTP Status codes in Google Sheets for URLs

Statuses and Codes:

Okay, this little hack has become a personal favorite for me and I had to share it. I had to clean up a sitemap with over 6000 URLs and I just happened to not have my Screamingfrog (God bless the frog) License with me. I remembered the good old script editor inside Google Sheets and decided t give it a try. So Here's how you get HTTP status codes in google sheets.

HTTP STATUS CODE in Google Sheets App Script:

HOW TO RUN THE HTTP STATUS CODE CHECKER

Head to your Google Sheets and open up the script editor

function httpstatus( uri )
{
 var response_code ;
try {
 response_code = UrlFetchApp .fetch( uri ) .getResponseCode() .toString() ;
 }
catch( error ) {
 response_code = error .toString() .match( / returned code (\d\d\d)\./ )[1] ;
 }
finally {
 return response_code ;
 }
}

Paste the above script into the script editor. 
Remember the function name "httpstatus" is going to be your new custom command to check status codes

Save and give the project a name and accept the permissions required for it to run.

Checking the Status Codes

And Now for the moment of truth:

Go back to the google sheet and place the URL/ Domain in any Cell

I choose to bulk check a lot of them so pasted an array of domains in A.

Use the following Formula in B

and there you have it a quick and easy way to check HTTP status codes in Google Sheets.

Dan.marketing is the personal website of Daniel (Dan) Antony, a digital marketer passionate about business and technology
© Copyright 2023 - Oxygen - All Rights Reserved
envelopephone-handsetmap-marker
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram