Data Cleaning and Formatting Geocoding Addresses with Google Maps

Automatically clean raw address data, retrieve precise latitude and longitude coordinates using the Google Maps API, and sync the formatted data directly to your Monday.com boards.

Getting accurate location data requires clean input. This guide walks you through the automated pipeline that scrubs messy address entries, standardizes them, fetches their exact coordinates, and maps everything neatly into Monday.com.

flowchart TD
    A["Raw Address Input"] --> B["Address Normalization Script"]
    B --> C["Cleaned Address Components"]
    C --> D["Google Maps Geocoding API"]
    D --> E["Lat / Lng Coordinates"]
    C --> F["Monday.com Board"]
    E --> F

Prerequisites

Before setting up this workflow, ensure you have:

  • A Google Maps API Key with the Geocoding API enabled.

  • A Monday.com board (e.g., "Orders") configured with a Location column and Text columns for address components (City, State, Zip, Unit, etc.).


Never commit your Google Maps API key to source control or expose it in client-side code. Always use environment variables or a secure secrets manager to pass the key to your automation tools.

How the Geocoding Workflow Works

The process is broken down into three main phases: cleaning the data, fetching the coordinates, and saving the results.

  1. 1

    Clean and normalize the address

    Raw addresses often contain hidden characters, inconsistent abbreviations, or messy unit numbers. The workflow runs a script (available in Python or JavaScript) to standardize the text before sending it to Google.

    Key cleaning actions include:

    • Ghost Scrubbing: Removes invisible control characters and zero-width spaces.

    • Smart Title Casing: Capitalizes words correctly while respecting exceptions like "USA", "NC", and names starting with "Mc" (e.g., McDonald).

    • Unit Extraction: Identifies and separates unit numbers (Apt, Suite, #) from the main street address.

  2. 2

    Geocode with Google Maps

    Once the address is formatted (e.g., 1613 Arapahoe Ridge, Raleigh, NC 27603), the workflow makes a GET request to the Google Maps Geocoding API.

    GET https://maps.googleapis.com/maps/api/geocode/json
      ?address=1613+Arapahoe+Ridge,+Raleigh,+NC+27603
      &components=country:US|administrative_area:NC
      &key=YOUR_API_KEY

    Using the components parameter (like country:US|administrative_area:NC) helps restrict results to a specific region, drastically improving accuracy if your addresses are localized.

  3. 3

    Map data to Monday.com

    Finally, the workflow updates the Monday.com item. It populates the dedicated Location column with the retrieved lat and lng coordinates, and fills out individual text columns for streetOnly, city, state, zip, and unitOnly.

Address Formatting Rules

To ensure Google Maps returns the most accurate coordinates, the normalization script applies specific rules to street suffixes and abbreviations.

The "Saint" vs. "Street" Rule

The abbreviation "St" is notoriously tricky because it can mean "Saint" or "Street" depending on its position in the address. The script uses contextual logic to expand it correctly:

Raw InputPosition ContextNormalized Output
2123 St Marys St"St" at the beginning and end2123 St Marys Street
2123 Saint Marys Street"Saint" spelled out2123 St Marys Street
100 Main St"St" at the end100 Main Street

Standard Abbreviations

Common street suffixes are automatically expanded to their full words to maintain clean, readable records in Monday.com.

AbbreviationExpanded Form
AVE / BLVDAvenue / Boulevard
CIR / CTCircle / Court
DR / LNDrive / Lane
PKWY / PLParkway / Place
RD / WYRoad / Way
TER / TRLTerrace / Trail
How are apartment and suite numbers handled?

Unit numbers are aggressively cleaned. The script looks for keywords like UNIT, APT, STE, SUITE, APARTMENT, or #. It extracts the alphanumeric value, strips out unnecessary punctuation (like periods or dashes), and standardizes the output to a clean format like Unit 101. This prevents unit numbers from confusing the Google Maps Geocoding API.

What happens if the address has trailing garbage text?

The script uses a "Refined Truncation" method. It scans the address for the last recognized street suffix (like Road, Street, Lane) and cuts off any unrecognized text that follows it. This is highly effective for removing accidental notes or routing instructions appended to the end of an address line.