Bulk package tracking for Australia Post with Google Docs

Posted 15 June 2012

One of my companies sells animal onesies (buy one, because they are awesome), and it imports a good quantity of goods into Australia via EMS.

I hunted around for a website that would let me instantly see the status of my packages waiting to be delivered. Australia’s post website is pretty impressive, and I take my hats off to the agency responsible because they’ve done a good job; but I wanted an overview without clicking each box and/or reentering my package number a dozen times.

I tried a few iPhone apps, but having to type all of the numbers in one-by-one was a real pain, what I really wanted was a spreadsheet. Could Google Docs help me?

It turns out, yes it can. Google recently implemented a importXML function which lets us do all sorts of fancy things.

Column A. Enter your tracking numbers

Column B. Construct our “API” endpoint URL, =CONCAT("http://auspost.com.au/track/track.html?id=",A2)

Column C. Fetch the package status, =importXML(B2, "//div[@class='layout-third-column']/span")

Column D. Fetch the latest date/activity/location row, =importXML(B2, "//div[@class='trackingDetails clearfix']//table/tbody/tr[2]")

The last column will spread into Column E and F automatically. Brilliant, this works perfectly and our staff can now see the status of all our deliveries in a single glance.

Here’s what it looks like: