text: With the following little piece of code, you can retrieve the distance between two points.
  
  Code
  
  function getDirection(city1, city2, unit) {
    var directions = Maps.newDirectionFinder()
      .setOrigin(city1).setDestination(city2)
      .setMode(Maps.DirectionFinder.Mode.DRIVING)
      .getDirections();
    var d = directions.routes[0].legs[0].distance.text;
  
    var distance, value = d.split(" ")[0].replace(",", ""), text = d.split(" ")[1];
    if(text == unit) {
      distance = value;
    } else if(text == "km" &amp;&amp; unit == "mi") {
      distance = value / 1.6;
    } else {
      distance = value * 1.6;
    }
    return Math.round(distance);
  }
  
  
  Explained
  
  The MAPs API, build on top of the Google Apps Script, will get the first direction (routes[0]) between the origin and destination. The returned value is stripped from comma's and parsed as an integer.
  
  Screenshot
  
  
  
  Note
  
  The distance returned can be either in kilometer or miles. I've added the calculation for "as the crow flies" as well (in miles).
  
  Add the script under Tools>Script editor in the spreadsheet. Press the bug button in the script editor and you're on the go !!
  
  Example
  
  I've created an example file for you: get driving distance
  
  References
  
  
  https://developers.google.com/apps-script/
  https://developers.google.com/apps-script/reference/maps/
  http://www.movable-type.co.uk/scripts/latlong.html