How to Link Postal Addresses to Google Maps in Google Sheets

Learn how to make postal addresses clickable in Google Sheets with a formula. Create hyperlinks that directly link an addres to Google Maps places.

Bob Canning writes: I have a Google Spreadsheet with postal addresses in column A. Each week, a real estate agent copies a section of those addresses to a “upcoming tour” tab on our website. The tab is shared with other real estate agents so they can see the addresses in the order they will be viewed on the tour. I would like to make all of the addresses clickable so that people can easily navigate to the next location on the tour. Is this possible?

Google Maps Links in Google Sheets

Make Addresses Clickable in Google Sheets

We can use custom functions in Google Sheets with the built-in HYPERLINK function to make any location clickable in the spreadsheet. And unlike other Google Maps functions, this approach doesn’t make any Maps API calls so there’s no restriction on the number of links that you can generate in a sheet.

Assuming that your postal addresses are in column A from row 2 to row 11, go to column B and paste the custom function. The first parameter refers to the cell, or range of cells, that contain the location that needs to be hyperlinked. You can set the second ‘satellite’ parameter to TRUE if you would like to link the map to the aerial view instead of the regular map view of Google Maps.

=GOOGLEMAPSLINK(A2:A11, FALSE)

The Google Maps Link function is obviously not part of Google Sheets but we can easily integrate it with the help of Google Apps Script.

Generate Maps URL with Apps Script

Open your Google Sheets spreadsheet. Click on “Extensions” in the top menu, then select “Apps Script.” In the Apps Script editor that opens, replace any existing code with the following function:

/**
 * Generate a Google Maps Link for any address
 *
 * @param {string} address - The postal address
 * @param {boolean} satellite - Show aerial view (TRUE or FALSE)
 * @returns {string} The Google Maps URL
 * @customFunction
 */

function GOOGLEMAPSLINK(address, satellite) {
  function createLink(query) {
    const baseUrl = 'https://maps.google.com/?q=' + encodeURIComponent(query);
    const mapsUrl = baseUrl + (satellite ? '&t=k' : '');
    return mapsUrl;
  }

  return Array.isArray(address) ? address.map(createLink) : createLink(address);
}

The GOOGLEMAPSLINK function can generate map links for addresses in a single cell as well as a range of cells.

We can also add another column to the sheet that will create a clickable link with the address text. Paste the following ArrayFormula function in cell C1. See demo sheet.

=ArrayFormula(HYPERLINK(B2:B11,A2:A11))

Clickable Address in Google Sheets

The hyperlinked postal addresses can also be copied and pasted directly into Word, or any rich text editor, including HTML Mail for Gmail.

Amit Agarwal

Amit Agarwal

Google Developer Expert, Google Cloud Champion

Amit Agarwal is a Google Developer Expert in Google Workspace and Google Apps Script. He holds an engineering degree in Computer Science (I.I.T.) and is the first professional blogger in India.

Amit has developed several popular Google add-ons including Mail Merge for Gmail and Document Studio. Read more on Lifehacker and YourStory

0

Awards & Titles

Digital Inspiration has won several awards since it's launch in 2004.

Google Developer Expert

Google Developer Expert

Google awarded us the Google Developer Expert award recogizing our work in Google Workspace.

ProductHunt Golden Kitty

ProductHunt Golden Kitty

Our Gmail tool won the Lifehack of the Year award at ProductHunt Golden Kitty Awards in 2017.

Microsoft MVP Alumni

Microsoft MVP Alumni

Microsoft awarded us the Most Valuable Professional (MVP) title for 5 years in a row.

Google Cloud Champion

Google Cloud Champion

Google awarded us the Champion Innovator title recognizing our technical skill and expertise.

Email Newsletter

Sign up for our email newsletter to stay up to date.

We will never send any spam emails. Promise.