Search code examples
google-sheetsweb-scrapingimportups

UPS Tracking On Google Sheet does not work


I used following formula get UPS live tracking feed and it works fine until yesterday. I think UPS has updated their site and this formula does not work anymore. Any idea or suggestions for how to get the tracking update from UPS?

=Index(IMPORTXML("https://wwwapps.ups.com/WebTracking/track?track=yes&trackNums="&A1,"//*[@id='tt_spStatus']"),1)

Now I am getting an error:

Imported content is empty


Solution

  • UPS updated this webpage. It no longer returns tracking information in the initial page response. It now instead makes a separate AJAX request to retrieve the information after the page is loaded.

    Use this formula instead with the URL updated to a different page on their site that returns tracking information in the initial page response:

    =Index(IMPORTXML("https://wwwapps.ups.com/tracking/tracking.cgi?tracknum="&A1,"//*[@id='tt_spStatus']"),1)