Bulk check URLs for 404 errors using Google Sheets

Do you want to check a list of URLs for 404 errors? You do not need to check all of them one by one. You can easily bulk check 404 errors using Google sheets. It is a very simple process. You can check hundreds or thousands of URL using a simple script.

1. To start, go to Google sheets and open a new sheet. Paste your list of URLs in one column.

2. Go to tools and then script editor. In the script editor, copy and paste the code that I have mentioned below, and save and close the editor.

function HTTPResponse( 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 ;
}
}

Check the following image for a better clarity.

3. After that go back to the sheet and in the next column put this formula. Don’t forget to replace the ‘reference cell’ with the cell number where the URL is.

=httpresponse(‘reference cell’)

For example, if your URL is in B2, the formula would be =httpresponse(b2)

4. Then drag this formula till the end of the list. It will take some time to calculate and after the calculation is done, you will get a list of status.

5. If the URL is working fine, it will return 200 status, otherwise, it will return some other error code like 404, 400, 500 etc.

I would recommend you to copy the status and paste it as text, otherwise, the formula will do a calculation every you open the sheet and if you have a long list, it might make the sheet unresponsive for some time.

Leave a Reply

Your email address will not be published. Required fields are marked *