In this guide, I’ll walk you through a handy method for quickly checking the status of URLs right within Google Sheets using Google Apps Script. This is particularly useful for monitoring status codes in bulk without the need to leave Google Sheets to use a different tool.
I have been using it to speed up Hreflang alt URLs status verification in Google Sheets. This works well with Screaming Frog hreflang_all.csv exports.
Open Google Sheets and go to Extensions > Apps Script.
Create a new AppScript and paste the following code:
How to Use the AppScript
1, In cell E2, enter the URL you want to check, e.g., https://example.com.
2, Create a new blank F column.
3, In cell F2, enter the formula =HTTPStatus(F2).
4, drag down the formula.
5, repeat as required
This setup will call the custom HTTPStatus function and display the HTTP status code of the URL specified in cell E2.
I have been using it to speed up Hreflang alt URLs status verification in Google Sheets. This works well with Screaming Frog hreflang_all.csv exports.
Open Google Sheets and go to Extensions > Apps Script.
Create a new AppScript and paste the following code:
Code:
function HTTPStatus(url) {
if (url === '') return '';
try {
var response = UrlFetchApp.fetch(url, {'muteHttpExceptions': true});
return response.getResponseCode();
} catch (e) {
return 'ERROR';
}
}
How to Use the AppScript
1, In cell E2, enter the URL you want to check, e.g., https://example.com.
2, Create a new blank F column.
3, In cell F2, enter the formula =HTTPStatus(F2).
4, drag down the formula.
5, repeat as required
This setup will call the custom HTTPStatus function and display the HTTP status code of the URL specified in cell E2.