Last active
September 11, 2024 18:13
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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