Get Started Transforming Your Data in Snowflake

How to plot Latitude and Longitude from Google Sheets into Looker?

  • Looker FAQs
  • January 20, 2018

This post shows how to use Google Sheets to get latitude or longitude and then map them into Looker.

To achieve this, first, we can deploy a script in Google Sheets that would convert an address into Latitude and Longitude.

  1. In your Google Spreadsheet, enter the address in the first column as follows:

  2. Now go to Tools and then click on Script Editor.
  3. Copy and paste the below code in the editor:

    function geo_function_test() {
     var geo_sheet = SpreadsheetApp.getActiveSheet();
     var data_range = geo_sheet.getDataRange();
     var geo_cells = data_range.getValues();
     var latitudes = [];
     var longitudes = [];
     for (var z = 0; z < geo_cells.length; z++) {
       var geo_address = geo_cells[z][0];
       var geo_coder = Maps.newGeocoder().geocode(geo_address);
       var res = geo_coder.results[0];
       var lat = lng = 0;
       if (res) {
         lat =;
         lng = res.geometry.location.lng;
     .offset(0, 0, latitudes.length)
     .offset(0, 0, longitudes.length)

  4. Save this as a new project.
  5. Run this script by hitting the run button.

  6. The coordinates should appear in the next two columns as follows:

Once you have the Longitude / Latitude coordinates, you can load this data into a table within your choice database. Using the table, we can create a view called location and join this view with any table containing area codes, which would allow us to plot the areas on a map easily.

Up Next:

Read Is it possible to tie a dashboard filter in Looker to multiple fields in the same Look?

More Resources We Think You Might Like

How to create a funnel chart visualization in Looker?

How to create a funnel chart visualization in L...

A Funnel chart is best used to understand the linear sequence of events, such as search movement ...

  • Looker FAQs
  • January 15, 2018
How to create a funnel chart visualization in Looker?

How to add image from my local drive (or locati...

We can use the HTML parameter in the LookML of the Dimension / Measure to have Looker render the ...

  • Looker FAQs
  • January 21, 2018
How to create a funnel chart visualization in Looker?

How to change the order of stacks in a stacked ...

A stacked area chart is an extension of a basic area chart. It is used to group values of multipl...

  • Datameer, Inc.
  • January 25, 2018