1

It seems that it is easy enough to get the URL to one address using the following formula:

=HYPERLINK(CONCATENATE("https://www.google.com/maps/search/?api=1&query=",L13),"MAP")

Where L13 is an address.

However, I am interested in creating a URL that links two addresses together, so that when I click the hyperlink, it will process it as if I had entered two separate addresses and asked for directions. Perhaps this requires Apps Script, but if not I'd love to see a formula.

0

2 Answers 2

1

Google Maps accepts the address format Hyde Park, London to Trafalgar Sq, London, so you can put the start address in L13 and the destination in M13 and concatenate the two together like this:

=hyperlink("https://www.google.com/maps/search/?api=1&query=" & L13 & " to " & M13, "directions")

0

Map Directions: Two or More Locations

To generate the URL you can simply use "https://www.google.com/maps/dir/" joined to two or more locations delimited using the slash "/". This can be done using & or the JOIN function.

Example Data

A
1 Columbia University
2 National Museum of Mathematics
3 United Nations Headquarters
4 Times Square, Manhattan
5 The Metropolitan Museum of Art
6 Central Park Zoo
7 Empire State Building
8 Museum of Ice Cream

Example Formulas

Either of the following formulas would work

=HYPERLINK("https://www.google.com/maps/dir/" &
   JOIN("/",TOCOL(A:A,1)))
=HYPERLINK("https://www.google.com/maps/dir/" 
   & A1 & "/" & A2 & "/" & A3 & "/" & A4 & "/"
   & A5 & "/" & A6 & "/" & A7 & "/" & A8)

Maps will regenerate the URL similar to:

https://www.google.com/maps/dir/Columbia+University,+116th+and+Broadway,+New+York,+NY+10027,+United+States/National+Museum+of+Mathematics,+11+E+26th+St,+New+York,+NY+10010,+United+States/United+Nations+Headquarters,+405+E+42nd+St,+New+York,+NY+10017,+United+States/Times+Square,+Manhattan,+NY+10036,+United+States/The+Metropolitan+Museum+of+Art,+1000+5th+Ave,+New+York,+NY+10028,+United+States/Central+Park+Zoo,+East+64th+Street,+New+York,+NY+10021,+United+States/Empire+State+Building,+20+W+34th+St.,+New+York,+NY+10001,+United+States/MUSEUM+OF+ICE+CREAM,+558+Broadway,+New+York,+NY+10012,+United+States/@40.7712554,-74.0521721,12z/data=!3m1!4b1!4m49!4m48!1m5!1m1!1s0x89c2f63e96d30dc9:0x577933f947e52750!2m2!1d-73.9625727!2d40.8075355!1m5!1m1!1s0x89c259a6f4d60159:0x8798ba3704f2bc28!2m2!1d-73.987093!2d40.7435349!1m5!1m1!1s0x89c2591ce0874d11:0xc5fae28bdd3df635!2m2!1d-73.9674781!2d40.749168!1m5!1m1!1s0x89c25855c6480299:0x55194ec5a1ae072e!2m2!1d-73.9855426!2d40.7579747!1m5!1m1!1s0x89c25896f660c26f:0x3b2fa4f4b6c6a1fa!2m2!1d-73.963244!2d40.7794366!1m5!1m1!1s0x89c258f1fcd66869:0x65d72e84d91a3f14!2m2!1d-73.9718335!2d40.767778!1m5!1m1!1s0x89c259a9b3117469:0xd134e199a405a163!2m2!1d-73.9856644!2d40.7484405!1m5!1m1!1s0x89c259e713d43875:0xbfd5eb3c3e1bb328!2m2!1d-73.9979167!2d40.7238545?entry=ttu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.