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

Append Postal Codes to Online Order IPs for Regional Analysis in a Google Sheet

2026-05-14
5 min read

The Scenario

You're a retail analyst. The logistics team emailed you last Tuesday: they're running a last-mile delivery study and need to know which of the last 30 days of online orders fall into which regional delivery zones. You have 4,000 order records in a Google Sheet — each with an order ID, customer name, and the IP address recorded at checkout. Column B has the IP. Column A has the order ID. A delivery zone lookup table lives in Sheet2.

You need the postal code for every IP appended to column C, and then a zone name from the lookup table in column D. The study report is due Friday.

The bad version:

  • Write a script to call the IPinfo single-IP endpoint for each of the 4,000 orders — 4,000 individual API calls.
  • Parse the postal code field from each JSON response, write to a CSV.
  • Import back into the sheet, align on order ID, VLOOKUP against Sheet2 to add the zone name.

4,000 individual API calls at standard rate limits takes a while. The join with the delivery zone table is straightforward once the postal codes are in, but getting there eats the time you needed for the actual study analysis.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent inside your Google Sheet. It calls IPinfo for every IP in your list, writes the postal code back to column C, and handles the VLOOKUP against your delivery zone table in the same prompt.

Open the SheetXAI sidebar with the order sheet open and paste:

For each IP in column B, use IPinfo to retrieve the postal code and write it to column C, then use VLOOKUP to match postal codes against the delivery zone table in Sheet2 and write the zone name to column D.

What You Get

  • Column C: postal code for each order IP (e.g., "10001", "90210", "SW1A 1AA")
  • Column D: delivery zone name matched from Sheet2 — whatever zone label corresponds to that postal code
  • Rows where IPinfo returns no postal code get empty cells in C and D — not errors — so you can filter them out for manual review
  • All 4,000 rows handled in one operation, including the zone join

What If the Data Is Not Quite Ready

Multiple orders share the same IP (same household, same device) and I want to deduplicate for the API call

Many order IPs in column B repeat across rows. Deduplicate column B, look up postal codes via IPinfo for unique IPs, write results to a lookup cache tab, then VLOOKUP the postal code back to column C for every row in the main sheet and use a second VLOOKUP to write the zone name from Sheet2 to column D.

Some postal codes aren't in the delivery zone table and I need to flag them

Look up postal code for each IP in column B using IPinfo, write to column C. VLOOKUP against Sheet2 to find the delivery zone and write to column D. For any row where VLOOKUP finds no match, write "Zone Not Mapped" in column D instead of an error.

I need the postal code plus country to handle international orders separately

Fetch postal code and country for each IP in column B using IPinfo. Write postal code to column C and country code to column D. For rows where country is not "US," skip the zone VLOOKUP and write "International" in column E. For US rows, VLOOKUP the postal code against the delivery zone table in Sheet2 and write the zone to column E.

Full logistics study pipeline

Column B has 4,000 order IPs. Look up postal code and country via IPinfo. Write postal code to column C, country to column D. For US orders, VLOOKUP against Sheet2 to get the delivery zone and write to column E; flag non-matched US postal codes as "Zone Not Mapped." For non-US orders, write "International" in column E. Write a summary tab called "Zone Distribution" with zone name and order count per zone, sorted by count descending.

From IP list to logistics study input in one prompt.

Try It

Get the 7-day free trial of SheetXAI and open any Google Sheet with customer or order IP addresses, then ask it to append postal codes from IPinfo and match them against your delivery zone table. See also timezone enrichment for scheduling workflows or company identification from visitor IPs. Hub: IPinfo + Google Sheets.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more