Skip to content

Instantly share code, notes, and snippets.

@JoeyBurzynski
Last active December 17, 2023 20:42
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoeyBurzynski/d8e336f80361e3ed258bb860e32c48d3 to your computer and use it in GitHub Desktop.
Save JoeyBurzynski/d8e336f80361e3ed258bb860e32c48d3 to your computer and use it in GitHub Desktop.
Google Sheets Function (SEO, How to Fetch HTTP Status Code for URL in Google Sheets)
/**
Google Sheets Function (Fetch HTTP Status Code for URL)
How to Fetch HTTP Status Code for URL in Google Sheets
Reference URL: https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app
**/
function getStatusCode(url){
var options = {
'muteHttpExceptions': true,
'followRedirects': false
};
var url_trimmed = url.trim();
var response = UrlFetchApp.fetch(url_trimmed, options);
return response.getResponseCode();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment