Skip to Content
BuddyGeoDocs

Google Sheets geocoding

Geocode addresses or reverse-geocode coordinates directly inside Google Sheets using a zero-dependency Apps Script with built-in caching.

You can geocode directly inside Google Sheets without paying for a third-party marketplace add-on. The BuddyGeo Apps Script adds both spreadsheet formulas and a batch menu action, with built-in 6-hour caching so recalculating a sheet does not double-charge credits.

For large files (2,000 to 50,000 rows), upload the sheet directly in Bulk geocoding for faster asynchronous processing and a free max-cost preview.

Install in 60 seconds

  1. Download buddygeo-google-sheets.gs (or copy the script below).
  2. In your Google Sheet, click Extensions → Apps Script.
  3. Replace the empty file with the BuddyGeo script and click Save.
  4. Reload your spreadsheet and click BuddyGeo → Set API Key in the top menu.
  5. Paste an API key from API keys. The Free tier includes 2,500 monthly credits with no credit card required.

Custom formulas

Once installed, use these formulas in any cell:

FormulaOutput
=BUDDYGEO_GEOCODE(A2)"43.642566, -79.387057"
=BUDDYGEO_LAT(A2)43.642566
=BUDDYGEO_LON(A2)-79.387057
=BUDDYGEO_GEOCODE(A2, "ca")Restrict search to ISO country code ca
=BUDDYGEO_REVERSE(B2, C2)Nearest formatted street address for (lat, lon)

Spreadsheet formulas recalculate whenever Google Sheets refreshes. For static enrichment:

  1. Highlight your column of addresses (or two adjacent Latitude and Longitude columns).
  2. Click BuddyGeo → Geocode selected addresses (or Reverse geocode selected Lat/Lon).
  3. BuddyGeo writes plain values directly into the adjacent columns so coordinates are saved permanently with zero future API calls.

Minimal formula snippet

function BUDDYGEO_GEOCODE(address) {
  if (!address) return '';
  var key = PropertiesService.getUserProperties().getProperty('BUDDYGEO_API_KEY');
  var url = 'https://www.buddygeo.com/v1/search?q=' + encodeURIComponent(address) + '&limit=1';
  var resp = UrlFetchApp.fetch(url, { headers: { 'X-API-Key': key } });
  var data = JSON.parse(resp.getContentText());
  if (!data.result || !data.result.length) return '';
  var loc = data.result[0].location;
  return loc.lat.toFixed(6) + ', ' + loc.lon.toFixed(6);
}

Open in the app

On this page