Suppose you want to keep a Google Docs Spreadsheet to track your mileage and travel for business expenses.
VIEW DIRECTIONS XML
You can use the Google Maps API as follows. Open Google Chrome and enter the following address:
If you look at the target anchor, you will see origin=%22…%22&destination=%22…%22. Currently, the first … is a Starbucks location at Berryessa and Lundy in San Jose, CA and the second … is a Starbucks location at Alum Rock and White in San Jose, CA. %20 is a space. You can change this as you would like, but this will show an xml formatted “DirectionsResponse”.
If you look at the xpath “//DirectionsResponse/route/leg/duration/value” and “//DirectionsResponse/route/leg/duration/text” you will see 499 and 8 mins which reflect the time. If you look at the xpath “//DirectionsResponse/route/leg/distance/value” and “//DirectionsResponse/route/leg/distance/text” you will see 6846 and “4.3 mi” which reflect the distance.
ADD MILES CALCULATION DIRECTLY IN GOOGLE DOCS SPREADSHEET
In a Google Docs Spreadsheet, you can place in A1: 3103 Alum Rock Ave, San Jose, CA 95127
You can place in A2: 1712 Berryessa Rd, San Jose, CA 95133
Then, in A3: =importxml(“http://maps.googleapis.com/maps/api/directions/xml?origin=” & A1 & “&destination=” & A2 & “&sensor=false&alternatives=false”,”//DirectionsResponse/route/leg/distance/text”)
Or alternatively in A3: =importxml(“http://maps.googleapis.com/maps/api/directions/xml?origin=” & G213 & “&destination=” & H213 & “&sensor=false&alternatives=false”,”//DirectionsResponse/route/leg/distance/value”)/1000*.621371
The value is meters, so divide by 1000 to get kilo meters and then multiply by .621371 since 1 kilo meter is .621371 miles.
This was from productforums.google.com.
VIEW PLACE PAGE (Can be used on your phone to navigate to the location by hitting directions)
Open www.google.com in Google Chrome.
ADD HYPERLINK TO LOCATION IN GOOGLE DOCS
=Hyperlink(“www.google.com/maps/place/” & A1, “GO”)
In A1: Date In B1: Start In C1: Nav In D1: Destination In E1: Nav In F1: Distance In G1: Time In H1: Purpose In A2: 07/31/2014 In B2: 1712 Berryessa Rd, San Jose, CA 95133 In C2: =Hyperlink("www.google.com/maps/place/" & B2, "GO S") In D2: 3103 Alum Rock Ave, San Jose, CA 95127 In E2: =Hyperlink("www.google.com/maps/place/" & D2, "GO D") In F2: =importxml("http://maps.googleapis.com/maps/api/directions/xml?origin=" & B2 & "&destination=" & D2 & "&sensor=false&alternatives=false","//DirectionsResponse/route/leg/distance/value")/1000*.621371 In G2: =importxml("http://maps.googleapis.com/maps/api/directions/xml?origin=" & B2 & "&destination=" & D2 & "&sensor=false&alternatives=false","//DirectionsResponse/route/leg/duration/text") In H2: Appointment
This will calculate trip mileage and allow you to pull up recent locations to directly navigate when to recent locations.