Sheets Geocoder guide

Is There a GEOCODE Formula in Google Sheets? Three Practical Options

Google Sheets has no native GEOCODE function. Compare an add-on, a custom Apps Script function, and a direct geocoding API before choosing a workflow.

Quick answer

Google Sheets does not include a native GEOCODE formula. You can add geocoding through a Sheets add-on, create a custom Apps Script function backed by the built-in Maps service, or call a geocoding API from code. Add-ons are simplest for managed batches; Apps Script suits small technical workflows; direct APIs suit custom applications.

Why =GEOCODE(A2) does not work by default

Google Sheets recognizes only built-in functions and custom functions attached to the spreadsheet. If a tutorial shows =GEOCODE(A2), that workbook either contains Apps Script code or depends on an add-on. Copying the formula alone into a new spreadsheet will normally produce an unknown-function error.

Three practical ways to add geocoding

MethodBest forSetupMain limitation
Sheets add-onNontechnical batch workInstall and authorizePlan allowance and vendor dependency
Apps Script custom functionSmall sheets and learningWrite and authorize codeRecalculation, daily quota and runtime
Direct web APICustom systems and integrationsCloud project, billing, secured key and codeEngineering and usage charges

A fourth pattern—a menu-driven Apps Script batch—often behaves better than a custom function. It reads a selected range once and writes fixed results. The complete implementation is covered in the Apps Script guide.

A minimal custom function for learning

This example uses the built-in Apps Script Maps service. It is intentionally small; production code should add status handling, batching and an explicit retry policy.

Apps Script custom function
/** @customfunction */
function GEOCODE(address) {
  if (!address) return [["", ""]];
  const response = Maps.newGeocoder().geocode(String(address));
  if (response.status !== "OK" || !response.results.length) {
    return [["NO_MATCH", "NO_MATCH"]];
  }
  const point = response.results[0].geometry.location;
  return [[point.lat, point.lng]];
}
  1. Open Apps Script.

    Choose Extensions → Apps Script from the spreadsheet.

  2. Add and save the function.

    Replace the starter code with the example, save, and return to the sheet.

  3. Enter the formula.

    Use =GEOCODE(A2) with two empty destination cells for the result.

  4. Authorize when prompted.

    Review the requested access and continue only if it matches the code you expect.

Do not paste a secret web-service API key into a cell or public spreadsheet. Google recommends restricting keys and keeping web-service keys out of source code.

Choose based on operational responsibility

Use a custom function if you want to learn, have a small sheet, and can tolerate quotas or occasional recalculation. Use a managed add-on when users need to select rows, control output fields and process larger batches without maintaining code. Use a direct API when geocoding is one component of a larger application and your engineering team can own credentials, monitoring, retries and billing.

Sources and methodology

Technical claims were checked against the sources below on August 18, 2026. Product limits and third-party pricing can change; verify the live documentation before designing a production workflow.

Common questions

Does Google Sheets have a built-in GEOCODE function?

No. GOOGLEFINANCE, GOOGLETRANSLATE and several Google-specific functions exist, but GEOCODE is not a native Sheets function. A formula with that name comes from custom Apps Script or an installed add-on.

Why does a custom GEOCODE formula keep recalculating?

Custom functions participate in spreadsheet recalculation and can be invoked repeatedly when dependencies change. For paid APIs or large ranges, a menu-driven batch that writes fixed values is easier to control.

Can one formula return latitude and longitude?

Yes. A custom function can return a two-column array, but the adjacent cell must be empty so the result can expand.

Is an add-on more accurate than a formula?

Not inherently. Accuracy comes from the data provider, input quality and how results are interpreted. The add-on primarily changes workflow, reliability, output controls and support.

Start with your own sheet

Geocode your first 100 rows free.

No API key, custom formula, or credit card required.

Install from Marketplace