How to Geocode Addresses in Google Sheets: 4 Methods That Actually Work

| April 10, 2026
How to Geocode Addresses in Google Sheets: 4 Methods That Actually Work

If you have a Google Sheet full of addresses and need latitude/longitude coordinates, you are in the right place. Whether you are mapping customer locations, planning delivery routes, or building a store locator, geocoding in Google Sheets is one of the most common data tasks that nobody teaches you how to do properly.

The problem? Google Sheets has no built-in geocoding function. There is no =GEOCODE() formula waiting for you. But there are four practical methods to get it done, ranging from zero code to fully automated batch processing.

In this guide, I will walk you through every approach to geocode addresses in Google Sheets -- from a simple copy-paste workflow to custom Apps Script functions that turn your spreadsheet into a geocoding machine. Every code example is real, tested, and ready to use with the CSV2GEO geocoding platform.

Let's get into it.

Who Needs to Geocode Addresses in Google Sheets?

Before we dive into the methods, here is who typically needs this:

🏢

Real Estate Teams

Map property listings, analyze neighborhoods, and calculate distances between comparable properties from a shared Google Sheet.

🚚

Logistics & Delivery

Convert delivery addresses to coordinates for route optimization software. Process hundreds of stops from a daily dispatch sheet.

📊

Market Researchers

Geocode survey respondent locations, retail store addresses, or competitor locations for spatial analysis and heatmaps.

🏗

Insurance & Risk Analysts

Geocode policyholder addresses for flood zone checks, proximity to fire stations, and catastrophe modeling.

🏫

Nonprofits & Government

Map service locations, constituent addresses, and program participants across districts using shared collaborative sheets.

⚙️

Sales & Field Teams

Geocode prospect lists, assign territories by coordinates, and plan field visit routes directly from your CRM export.

The common thread? You have addresses in a spreadsheet. You need coordinates. And you do not want to pay Google $5 per 1,000 lookups to get them.

Method 1: No-Code -- Export CSV, Upload to CSV2GEO, Paste Back

Best for: Anyone who wants coordinates without writing a single line of code.

This is the simplest approach to geocode a spreadsheet. No API keys, no scripting, no technical setup. Just export, upload, download, paste.

Step 1: Export Your Google Sheet as CSV

Open your Google Sheet with addresses. Go to File > Download > Comma Separated Values (.csv). This downloads the current sheet as a CSV file to your computer.

Make sure your address data is clean. You want columns like street address, city, state, zip code, and country -- or at minimum a single column with the full address.

Step 2: Upload to CSV2GEO

Go to CSV2GEO and drag your CSV file onto the upload area. The platform will automatically detect your columns and ask you to map them:

  • Street -- your street address column
  • City -- city or town
  • State -- state or province
  • Zip -- postal code
  • Country -- country name or ISO code

Click Process and CSV2GEO will geocode every row using its database of 461M+ addresses across 200+ countries.

Step 3: Download the Results

Once processing finishes, download your geocoded file. It will contain all your original columns plus new ones: latitude, longitude, formatted address, and an accuracy score so you know how confident each result is.

Step 4: Paste Back into Google Sheets

Open the downloaded CSV in Google Sheets (File > Import), or simply copy the latitude and longitude columns and paste them into your original sheet.

That is it. No code, no API key, no configuration. The free geocoding tier gives you 100 rows per day at no cost, which is enough for many small projects.

Method 2: Apps Script Custom Function -- =GEOCODE(A2)

Best for: Users who want a formula-style experience directly in their spreadsheet.

This method uses Google Apps Script and the CSV2GEO geocoding API to create a custom =GEOCODE() function that works just like any other spreadsheet formula.

Step 1: Get Your API Key

Go to CSV2GEO API Keys and generate a free API key. The free tier includes 1,000 API requests per day -- more than enough for most spreadsheet workflows.

Step 2: Open the Apps Script Editor

In your Google Sheet, go to Extensions > Apps Script. This opens the script editor where you will paste the geocoding function.

Step 3: Add the Geocoding Function

Delete any existing code and paste this:

/**
 * Geocodes an address using the CSV2GEO API.
 * Returns latitude and longitude as "lat, lng".
 *
 * @param {string} address The full address to geocode.
 * @param {string} country The ISO country code (e.g., "US", "GB", "DE").
 * @return {string} Latitude and longitude as "lat, lng".
 * @customfunction
 */
function GEOCODE(address, country) {
  if (!address) return "";
  
  var API_KEY = "YOUR_API_KEY_HERE"; // Replace with your CSV2GEO API key
  var encodedAddress = encodeURIComponent(address);
  var countryParam = country ? "&country=" + encodeURIComponent(country) : "";
  
  var url = "https://api.csv2geo.com/v1/geocode?q=" + encodedAddress + countryParam + "&api_key=" + API_KEY;
  
  try {
    var response = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
    var json = JSON.parse(response.getContentText());
    
    if (json.results && json.results.length > 0) {
      var location = json.results[0].location;
      return location.lat + ", " + location.lng;
    }
    return "Not found";
  } catch (e) {
    return "Error: " + e.message;
  }
}

Step 4: Use It in Your Sheet

Save the script (Ctrl+S), then go back to your spreadsheet. Now you can use the formula just like any built-in function:

=GEOCODE("1600 Pennsylvania Ave NW, Washington, DC 20500", "US")

This returns: 38.8977, -77.0365

You can also reference cells:

=GEOCODE(A2, B2)

Where column A has the address and column B has the country code.

Important note: Custom functions in Google Sheets run one at a time. If you put =GEOCODE() in 500 rows, each one makes a separate API call sequentially. For large datasets, use Method 3 instead.

Method 3: Batch Geocoding with Apps Script Custom Menu

Best for: Processing hundreds or thousands of addresses efficiently.

This method adds a "Geocoding" menu to your Google Sheet that lets you geocode an entire column of addresses in one click. It processes rows in batches with rate limiting built in, so you will not hit any API limits.

Step 1: Add the Batch Geocoding Script

Open Extensions > Apps Script and paste this complete script:

var API_KEY = "YOUR_API_KEY_HERE"; // Replace with your CSV2GEO API key

/**
 * Adds a custom Geocoding menu to Google Sheets.
 */
function onOpen() {
  SpreadsheetApp.getUi()
    .createMenu("Geocoding")
    .addItem("Geocode Selected Range", "geocodeSelected")
    .addItem("Geocode All Addresses", "geocodeAll")
    .addSeparator()
    .addItem("Reverse Geocode Selected", "reverseGeocodeSelected")
    .addToUi();
}

/**
 * Geocodes all addresses in column A, writes lat/lng to columns B and C.
 */
function geocodeAll() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var lastRow = sheet.getLastRow();
  
  if (lastRow < 2) {
    SpreadsheetApp.getUi().alert("No data found. Add addresses starting from row 2.");
    return;
  }
  
  var addresses = sheet.getRange("A2:A" + lastRow).getValues();
  var countries = sheet.getRange("B2:B" + lastRow).getValues();
  var results = [];
  var processed = 0;
  var failed = 0;
  
  for (var i = 0; i < addresses.length; i++) {
    var address = addresses[i][0];
    if (!address) {
      results.push(["", "", "", ""]);
      continue;
    }
    
    var country = countries[i][0] || "";
    var result = geocodeAddress(address, country);
    results.push(result);
    
    if (result[0] !== "") {
      processed++;
    } else {
      failed++;
    }
    
    // Rate limiting: pause between requests to stay within limits
    Utilities.sleep(200);
    
    // Update progress every 50 rows
    if ((i + 1) % 50 === 0) {
      SpreadsheetApp.getActiveSpreadsheet().toast(
        "Processed " + (i + 1) + " of " + addresses.length + " addresses...",
        "Geocoding Progress"
      );
    }
  }
  
  // Write all results at once (much faster than row-by-row)
  sheet.getRange(2, 3, results.length, 4).setValues(results);
  
  // Set headers
  sheet.getRange("C1").setValue("Latitude");
  sheet.getRange("D1").setValue("Longitude");
  sheet.getRange("E1").setValue("Formatted Address");
  sheet.getRange("F1").setValue("Accuracy Score");
  
  SpreadsheetApp.getUi().alert(
    "Geocoding complete!\n" +
    "Processed: " + processed + "\n" +
    "Failed: " + failed + "\n" +
    "Skipped (empty): " + (addresses.length - processed - failed)
  );
}

/**
 * Geocodes only the currently selected range of addresses.
 */
function geocodeSelected() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var selection = sheet.getActiveRange();
  var startRow = selection.getRow();
  var numRows = selection.getNumRows();
  
  var addresses = selection.getValues();
  var countries = sheet.getRange(startRow, 2, numRows, 1).getValues();
  var results = [];
  
  for (var i = 0; i < addresses.length; i++) {
    var address = addresses[i][0];
    if (!address) {
      results.push(["", "", "", ""]);
      continue;
    }
    
    var country = countries[i][0] || "";
    results.push(geocodeAddress(address, country));
    Utilities.sleep(200);
  }
  
  // Write results starting from column C at the same row
  sheet.getRange(startRow, 3, results.length, 4).setValues(results);
}

/**
 * Geocodes a single address via the CSV2GEO API.
 * Returns [lat, lng, formatted_address, accuracy_score].
 */
function geocodeAddress(address, country) {
  var encodedAddress = encodeURIComponent(address);
  var countryParam = country ? "&country=" + encodeURIComponent(country) : "";
  var url = "https://api.csv2geo.com/v1/geocode?q=" + encodedAddress + countryParam + "&api_key=" + API_KEY;
  
  try {
    var response = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
    var json = JSON.parse(response.getContentText());
    
    if (json.results && json.results.length > 0) {
      var r = json.results[0];
      return [
        r.location.lat,
        r.location.lng,
        r.formatted_address || "",
        r.accuracy_score || ""
      ];
    }
    return ["", "", "Not found", ""];
  } catch (e) {
    return ["", "", "Error: " + e.message, ""];
  }
}

Step 2: Set Up Your Sheet

Organize your Google Sheet like this:

A: Address B: Country C: Latitude D: Longitude E: Formatted Address F: Accuracy Score
1600 Pennsylvania Ave NW, Washington, DC US (auto-filled) (auto-filled) (auto-filled) (auto-filled)
10 Downing Street, London GB (auto-filled) (auto-filled) (auto-filled) (auto-filled)
1 Infinite Loop, Cupertino, CA US (auto-filled) (auto-filled) (auto-filled) (auto-filled)

Step 3: Run the Geocoder

Reload your sheet (the onOpen function needs to run once). You will see a new "Geocoding" menu in the menu bar. Click Geocoding > Geocode All Addresses and watch as each row gets populated with coordinates.

The script processes rows with a 200ms delay between requests to respect rate limits. For 500 addresses, expect about 2 minutes of processing time. A progress toast notification keeps you updated every 50 rows.

Pro tip: If you have more than 1,000 addresses, split your work across multiple days using the free tier, or upgrade to a paid CSV2GEO plan for higher limits. Alternatively, export as CSV and use batch geocoding for the fastest results on large files.

Method 4: Reverse Geocoding in Google Sheets (Coordinates to Address)

Best for: When you already have latitude and longitude and need street addresses.

This is the opposite of forward geocoding. You have GPS coordinates -- maybe from a mobile app, IoT device, or field survey -- and you need to know what address those coordinates correspond to. This is called reverse geocoding.

The Reverse Geocode Function

Add this function to your Apps Script (Extensions > Apps Script):

/**
 * Reverse geocodes coordinates to a street address using CSV2GEO API.
 *
 * @param {number} lat Latitude.
 * @param {number} lng Longitude.
 * @return {string} The formatted street address.
 * @customfunction
 */
function REVERSE_GEOCODE(lat, lng) {
  if (!lat || !lng) return "";
  
  var API_KEY = "YOUR_API_KEY_HERE"; // Replace with your CSV2GEO API key
  var url = "https://api.csv2geo.com/v1/reverse?lat=" + lat + "&lng=" + lng + "&api_key=" + API_KEY;
  
  try {
    var response = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
    var json = JSON.parse(response.getContentText());
    
    if (json.results && json.results.length > 0) {
      return json.results[0].formatted_address;
    }
    return "Not found";
  } catch (e) {
    return "Error: " + e.message;
  }
}

Using It in Your Sheet

=REVERSE_GEOCODE(40.7484, -73.9857)

This returns something like: 350 5th Avenue, New York, NY 10118, United States

For batch reverse geocoding, the custom menu script from Method 3 already includes a reverseGeocodeSelected option. Add this function to complete it:

/**
 * Reverse geocodes the selected lat/lng range.
 * Expects column A = latitude, column B = longitude.
 * Writes address components to columns C-H.
 */
function reverseGeocodeSelected() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var selection = sheet.getActiveRange();
  var startRow = selection.getRow();
  var numRows = selection.getNumRows();
  
  var latitudes = sheet.getRange(startRow, 1, numRows, 1).getValues();
  var longitudes = sheet.getRange(startRow, 2, numRows, 1).getValues();
  var results = [];
  
  for (var i = 0; i < latitudes.length; i++) {
    var lat = latitudes[i][0];
    var lng = longitudes[i][0];
    
    if (!lat || !lng) {
      results.push(["", "", "", "", "", ""]);
      continue;
    }
    
    var url = "https://api.csv2geo.com/v1/reverse?lat=" + lat + "&lng=" + lng + "&api_key=" + API_KEY;
    
    try {
      var response = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
      var json = JSON.parse(response.getContentText());
      
      if (json.results && json.results.length > 0) {
        var r = json.results[0];
        var c = r.components || {};
        results.push([
          r.formatted_address || "",
          c.street || "",
          c.city || "",
          c.state || "",
          c.postcode || "",
          c.country || ""
        ]);
      } else {
        results.push(["Not found", "", "", "", "", ""]);
      }
    } catch (e) {
      results.push(["Error", "", "", "", "", ""]);
    }
    
    Utilities.sleep(200);
  }
  
  // Write results starting from column C
  sheet.getRange(startRow, 3, results.length, 6).setValues(results);
  
  // Set headers
  var headers = ["Formatted Address", "Street", "City", "State", "Postcode", "Country"];
  for (var h = 0; h < headers.length; h++) {
    sheet.getRange(1, 3 + h).setValue(headers[h]);
  }
  
  SpreadsheetApp.getUi().alert("Reverse geocoding complete! " + results.length + " rows processed.");
}

Understanding the API Response

When you call the CSV2GEO API, here is what comes back. Understanding the response structure helps you extract exactly the data you need in your scripts.

Field Type Description Example
results[].location.lat Number Latitude coordinate 38.8977
results[].location.lng Number Longitude coordinate -77.0365
results[].formatted_address String Full standardized address 1600 Pennsylvania Ave NW, Washington, DC 20500
results[].accuracy_score Number Confidence score from 0 to 1 0.97
results[].components.house_number String House or building number 1600
results[].components.street String Street name Pennsylvania Ave NW
results[].components.city String City or town Washington
results[].components.state String State or province DC
results[].components.postcode String ZIP or postal code 20500
results[].components.country String Country name United States

The accuracy_score field is particularly useful. A score of 0.95+ means rooftop-level precision. Scores between 0.7 and 0.95 indicate street-level accuracy. Below 0.7, the result may only be accurate to the city or postal code level.

Comparison: Which Google Sheets Geocoding Method Should You Use?

Feature Method 1: No-Code CSV Upload Method 2: =GEOCODE() Formula Method 3: Batch Menu Script Method 4: Reverse Geocode
Difficulty Beginner Easy Intermediate Easy-Intermediate
Coding Required None Paste-and-go Paste-and-go Paste-and-go
API Key Needed No Yes Yes Yes
Best For One-time jobs, non-technical users Small datasets, ad-hoc lookups Hundreds/thousands of rows GPS data to addresses
Speed (100 rows) ~30 seconds ~3 minutes ~25 seconds ~25 seconds
Free Tier 100 rows/day 1,000 requests/day 1,000 requests/day 1,000 requests/day
Max Rows Unlimited (with plan) ~100 (practical limit) Thousands Thousands
Output Columns Lat, Lng, Address, Score + more Lat, Lng (combined) Lat, Lng, Address, Score Address, Street, City, State, Zip, Country
Progress Tracking Visual progress bar Cell-by-cell Toast notifications Toast notifications

My recommendation: Start with Method 1 if you have a one-time job. Use Method 3 if you geocode regularly and want everything inside Google Sheets. For serious production workloads above 10,000 rows, skip the spreadsheet entirely and use batch geocoding with CSV2GEO directly -- it is dramatically faster.

Tips and Best Practices for Google Sheets Geocoding

1. Clean Your Addresses First

Garbage in, garbage out. Before geocoding, take five minutes to clean your data:

  • Remove extra spaces: Use =TRIM(A2) to strip leading, trailing, and double spaces
  • Standardize abbreviations: Decide between "Street" vs "St", "Avenue" vs "Ave" and be consistent
  • Include country codes: Always provide the ISO country code (US, GB, DE, FR) for better accuracy
  • Combine address parts: If your address is split across columns, concatenate them: =A2 & ", " & B2 & ", " & C2 & " " & D2

2. Always Include the Country

The single biggest improvement you can make to geocoding accuracy is providing the country. An address like "123 Main Street" exists in thousands of cities worldwide. Adding "US" narrows it to one country instantly.

3. Use Batch Processing for Large Datasets

The =GEOCODE() formula works great for 10-50 rows. Beyond that, use the batch menu script (Method 3) or export your sheet as CSV and upload it to CSV2GEO for batch geocoding. The file upload approach is 10x faster for large datasets because it processes rows in parallel on the server side.

4. Cache Your Results

Geocoding the same address twice is a waste. If you run the geocoding script multiple times, add a check to skip rows that already have coordinates:

// Skip rows that already have coordinates
if (sheet.getRange(i + 2, 3).getValue() !== "") {
  continue;
}

5. Handle Errors Gracefully

Some addresses simply will not geocode -- typos, incomplete data, or addresses that do not exist. The scripts above return "Not found" or "Error" messages so you can identify and fix problem rows manually.

6. Monitor Your API Usage

The free tier gives you 1,000 API requests per day. If you are geocoding a 5,000-row sheet, you will need to spread it across five days or upgrade your plan. Check your usage at your CSV2GEO dashboard.

7. Consider the API for Automation

If you geocode sheets regularly -- say, a weekly import of new customer addresses -- consider building an automated workflow using the full geocoding API. CSV2GEO offers 19 endpoints covering forward geocoding, reverse geocoding, batch operations, place search, and administrative boundary lookups. It is a complete platform, not just a single endpoint.

Frequently Asked Questions

Is geocoding in Google Sheets free?

Yes, you can geocode in Google Sheets for free using CSV2GEO. The no-code method (export CSV and upload) gives you 100 free rows per day. The API-based methods (Apps Script) give you 1,000 free requests per day. For most small to medium projects, the free tier is enough. If you need more, CSV2GEO offers affordable paid plans at a fraction of what Google Maps charges.

How many addresses can I geocode in Google Sheets?

With the free tier, up to 1,000 addresses per day using the API methods. With a paid plan, there is no practical limit -- the batch script processes thousands of rows efficiently. For very large datasets (50,000+ rows), I recommend exporting the sheet as CSV and using CSV2GEO's batch geocoding feature, which processes rows in parallel and is significantly faster than sequential API calls from Apps Script.

Do I need an API key to geocode in Google Sheets?

Only for Methods 2, 3, and 4 (the Apps Script methods). Method 1 (no-code CSV upload) does not require an API key at all -- you just upload your file to CSV2GEO and download the results. To get an API key for the script methods, visit CSV2GEO API Keys. It is free and takes about 30 seconds.

Can I geocode international addresses in Google Sheets?

Absolutely. CSV2GEO supports 200+ countries with address-level data for 39 countries and city-level coverage for the rest. The platform's database includes 461M+ addresses sourced from Scale Campaign. Just make sure to include the ISO country code (like "DE" for Germany, "JP" for Japan, "BR" for Brazil) for the best results. Check out guides for specific countries like geocoding addresses from Australia or geocoding addresses from Brazil.

How accurate is geocoding in Google Sheets?

The accuracy depends on your input data quality and the method you use -- all four methods use the same CSV2GEO geocoding engine. For well-formatted addresses in supported countries, expect rooftop-level accuracy (within a few meters) for 90%+ of results. The API response includes an accuracy_score field (0 to 1) so you can assess confidence for each result. Scores above 0.95 indicate rooftop precision. Learn more about accuracy in our guide on converting addresses to lat/long.

Can I reverse geocode (coordinates to address) in Google Sheets?

Yes. Method 4 in this guide covers reverse geocoding -- converting latitude and longitude coordinates back to street addresses. You can use the =REVERSE_GEOCODE() custom function for individual lookups or the batch menu script for processing hundreds of coordinate pairs at once. CSV2GEO also has a dedicated reverse geocoding tool if you prefer the no-code approach.

Will the geocoded data update automatically?

No. Geocoded coordinates are static values -- once written to your sheet, they do not change. If you update an address in column A, you need to re-run the geocoding function or script to get new coordinates. The =GEOCODE() formula (Method 2) will recalculate if you edit the referenced cell, but this uses an API call each time, so be mindful of your daily quota.

What is the difference between geocoding in Google Sheets vs Excel?

Google Sheets uses Apps Script (JavaScript-based), while Excel uses VBA or Office Scripts. The core workflow is the same: call an API, parse the response, write the results. Google Sheets has the advantage of being cloud-based, so scripts run on Google servers and your sheet is always accessible to collaborators. Excel is better for offline work and very large files (1M+ rows). We have a dedicated guide for geocoding Excel files if that is your preference.

Related Articles

*I.A. / CSV2GEO Creator*

Ready to geocode your addresses?

Use our batch geocoding tool to convert thousands of addresses to coordinates in minutes. Start with 100 free addresses.

Try Batch Geocoding Free →