Back to Interzoid in Google Sheets
SheetXAI logo
Interzoid logo
Interzoid · Google Sheets Guide

Normalize a Messy Country Column and Enrich It With ISO Codes in a Google Sheet

2026-05-15
5 min read

The Scenario

You're a data engineer. The ETL load job that runs nightly failed for the third time this week. The error log says: "Invalid country code at row 4,821." You trace it to the customer table — the country field has "US," "United States," "USA," "America," "U.S.," and 40 other variants, and the destination schema expects ISO-3166 alpha-2 codes. Only.

The table has 10,000 rows. The ETL runs at 2 AM. This is the fourth late-night fix in two weeks.

The bad version:

  • Build a manual mapping table of every country variant to its ISO code — which covers the ones you know about and misses the 12 edge cases you'll discover next week.
  • Write a regex normalization function that handles the most common forms — which works until someone submits "Россия" or "中国" and the regex returns null.
  • Delay the load, page the on-call engineer, and document the incident again.

The downstream analytics dashboard reads from this table. The business review is Thursday.

The Easy Way: One Prompt in SheetXAI

SheetXAI reads your Google Sheet and calls Interzoid's country data API for every row — returning ISO-3166 codes and metadata without you maintaining a mapping table.

For every country value in column D, call Interzoid to return the ISO-3166 alpha-2 code, alpha-3 code, and calling code and write them to columns E, F, and G.

What You Get

  • Column E: ISO-3166 alpha-2 code per row.
  • Column F: ISO-3166 alpha-3 code.
  • Column G: international calling code.
  • Rows where Interzoid could not resolve the country value flagged in a status column so you know exactly which rows need manual correction before the load.

What If the Data Is Not Quite Ready

Column D has a mix of country names and ISO codes already — some rows are already clean

For each value in column D, first check if it's already a valid ISO-3166 alpha-2 code. If so, write it as-is to column E. If not, call Interzoid to resolve it and write the alpha-2 code to column E. Flag unresolvable values in column F.

You also need currency symbols for the downstream schema

Standardize the country names in column A using Interzoid and write the canonical country name, ISO-2 code, and currency symbol to columns B, C, and D.

Some rows have blank country fields from records collected before the field was required

Skip rows where column D is blank. For all other rows, call Interzoid to resolve the country and write ISO-2 and ISO-3 codes to columns E and F. Flag blank rows as 'MISSING' in column E.

Full ETL prep pass in one shot

For each value in column D: skip blanks (flag as 'MISSING' in column E), check if already a valid ISO-2 code (write through), otherwise call Interzoid to resolve. Write ISO-2 to column E, ISO-3 to column F, calling code to column G, and currency symbol to column H. Flag unresolvable values as 'UNRESOLVED' in column E. Create a 'LoadReady' sheet with only rows where column E is a valid 2-letter code.

The ETL job runs clean. The 2 AM incident alert doesn't fire.

Try It

Get the 7-day free trial of SheetXAI and open your customer table — ask SheetXAI to resolve and standardize column D to ISO-3166 codes before tonight's load job. Then see the spoke on converting a multi-currency expense report to USD, or the full Interzoid integration overview.

Stop memorizing formulas.
Tell your spreadsheet what to do.

Join 4,000+ professionals saving hours every week with SheetXAI.

Learn more