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.
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.
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.