BabyYoda
BabyYoda

Reputation: 79

Is there a script that checks links from a list and determines if they are working?

I have a list of about 200 URLs and I want to check whether they are working or bring an error. Is there a script or a formula I can use that can show me whether a link is broken?

Upvotes: 0

Views: 60

Answers (1)

player0
player0

Reputation: 1

use:

function URLCHECK(url){
   var options = {
     'muteHttpExceptions': true,
     'followRedirects': false
   };
   var url_trimmed = url.trim();
   var response = UrlFetchApp.fetch(url_trimmed, options);
   return response.getResponseCode();
}

and formula:

=IF(URLCHECK(A2)>=400, "broken", "ok")

0

Upvotes: 1

Related Questions