TRAVELROUTEURL Function – Google Sheets

TRAVELROUTERUL gives spreadsheet users a link to directions in Google Sheets. This function generates links for hundreds of address pairs in seconds.

❗This custom function is only available to users of the Travel Formulas add-on from the Google Workspace Marketplace. Travel Formulas uses Google Maps for you while you stay in your spreadsheet.

Purpose

The TRAVELROUTEURL function returns a link to Google Maps directions.

All Travel Formulas

TRAVELTIME – Returns the trip duration between locations

TRAVELDISTANCE – Finds the trip distance between locations

TRAVELROUTEURL – Returns the link to your route in Google Maps™

TRAVELDIRECTIONS – Provides turn-by-turn directions

Syntax

=TRAVELROUTEURL(origin, destination, mode)

origin – The starting location

destination – The ending location

mode – The mode of travel (“driving”, “walking”, “bicycling”, “transit”) [optional, defaults to driving]

Examples

Example 1 – Two Addresses

Let’s start by keeping it simple and using two cities: one for the origin and the other for the destination.

Two addresses in the TRAVELROUTEURL function returning a link to Google Maps
Two Addresses

These locations are not complete addresses. But if Google Maps accepts them, the formulas work! If you click the link, you get complete driving directions from New York to Los Angeles.

This function accepts direct input such as “NY” but can also use cell references. We’ll switch to using cell references for the following examples, as they give us more flexibility.

Example 2 – Different Modes

We can evaluate drivingmass transitbiking, and walking. Each transit mode gives you a different link.

Different Google Maps links coming from the TRAVELROUTEURL function due to different modes
Different Modes of Travel

Let’s be clear, though—please don’t walk from New York to LA unless you have a lot of spare time and extra pairs of shoes.

Example 3 – Different Location Formats

Next, we’ll see how other geolocation methods, such as Plus codes and coordinates, also work, as shown below.

Rows 2 through 6 in the image above use the same locations but different methods to specify them. You can use a city name, a full address, a placename, Plus code, or even latitude and longitude.

Conclusion

In conclusion, the TRAVELROUTEURL formula is a versatile tool that helps you plan your trips without leaving Google Sheets.