None of these work for me in 2020 but here's what does:
Add this function in script editor:
function IMPORTJSON(url,xpath){
try{
// /rates/EUR
var res = UrlFetchApp.fetch(url);
var content = res.getContentText();
var json = JSON.parse(content);
var patharray = xpath.split("/");
//Logger.log(patharray);
for(var i=0;i<patharray.length;i++){
json = json[patharray[i]];
}
//Logger.log(typeof(json));
if(typeof(json) === "undefined"){
return "Node Not Available";
} else if(typeof(json) === "object"){
var tempArr = [];
for(var obj in json){
tempArr.push([obj,json[obj]]);
}
return tempArr;
} else if(typeof(json) !== "object") {
return json;
}
}
catch(err){
return "Error getting data";
}
}
This formula will output transit status in your cell:
=IMPORTJSON(join("","http://shipit-api.herokuapp.com/api/carriers/ups/",A1),"activities/0/details")
I don't need the other details, so I made another cell that has a link to the ups tracking page if any other users need more information:
=HYPERLINK("https://www.ups.com/track?loc=en_US&tracknum="&A1&"&requester=WT/trackdetails)")