Hyperlink 如何使用google电子表格使用公式检查断开的链接
我有一个URL的列表,我想检查响应代码。有人知道我如何在谷歌电子表格中做到这一点吗?我有1000个网址,所以这是一个相当大的要求。 此脚本无法正常工作Hyperlink 如何使用google电子表格使用公式检查断开的链接,hyperlink,formula,permalinks,array-formulas,google-sheets-query,Hyperlink,Formula,Permalinks,Array Formulas,Google Sheets Query,我有一个URL的列表,我想检查响应代码。有人知道我如何在谷歌电子表格中做到这一点吗?我有1000个网址,所以这是一个相当大的要求。 此脚本无法正常工作 function HTTPResponse( uri ) { var response_code ; try { response_code = UrlFetchApp .fetch( uri ) .getResponseCode() .toString() ; } catch( error ) { respons
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 ;
}
}
您可以检查下面的代码。如果URL正常,您将看到200作为响应:
function getStatusCode(url){
var response = UrlFetchApp.fetch(url);
return response.getResponseCode();
}