I can’t take credit for the code but you can take a look at the source at the link below. There are options to add features.
http://oco-carbon.com/coding/google-excel-distance-function/

As Kyle123 rightly says, it is in breach of the T&C’s but if you add a map to the spreadsheet it is within the T&C’s.
As I’m a naughty boy I leave off the map because it’s quicker but that’s just me.