In Minimizing maps directionfinder api calls I showed how to make the most of your directions API quota in the context of a spreadsheet. Here’s an example of calling it directly, say when you are working on a map viz and need to work on some directions and geocoding.
As a reminder, there are usage restrictions on the Directions API. You can read the terms of use here.

You can take a copy of this sheet and the code here


Let’s say we have a list of destinations and one start point, and want to sort the destinations in order of distance from the start point, and return coordinate, distance and driving time to each of these destinations. Using the functions in Minimizing maps directionfinder api calls, this becomes fairly trivial

Gives this result

For more like this see Google Apps Scripts Snippets
For help and more information join our forum, follow the blog, follow me on Twitter