The Scenario
You are a logistics coordinator. A route-planning tool your company uses requires latitude and longitude for every stop. Your customer list has 400 delivery city names in column A of an Excel workbook, the Deliveries tab, and nothing else.
The route-planning tool import fails without coordinates. Your ops manager needs the updated import file by 2 PM so drivers have tomorrow's routes before end of day.
The bad version of this afternoon:
- You search Google Maps for the first city, copy the coordinates from the URL
- You paste lat into column B, long into column C
- By city fifteen you are losing your place in the list
- At 1:45 PM you have done 80 cities and have 320 left
- The ops manager sends routes without your 320 missing stops.
The fast version is one prompt.
The Easy Way: One Prompt in SheetXAI
SheetXAI is an AI agent inside your Excel workbook. It reads your city list and calls the API Ninjas geocoding endpoint for each row, writing coordinates back to the columns you name.
Open the SheetXAI sidebar and type:
Geocode every city in column A of the Deliveries tab using API Ninjas and write the latitude into column B and longitude into column C. If a city returns no result, write "NOT FOUND" in both columns so I can review those rows.
SheetXAI calls the geocode endpoint for all 400 cities, extracts the lat and long fields, and writes them back. The NOT FOUND rows are flagged so you can manually review edge cases.
What You Get
A workbook with every city geocoded:
- Column B: Latitude — decimal degrees
- Column C: Longitude — decimal degrees
- NOT FOUND rows flagged — unresolved cities are visible instead of silently wrong
Ready to drop into your route-planning tool's import format without a second pass.
Need county and timezone too? Ask for those in the same prompt and SheetXAI writes them into columns D and E.
What If the Data Is Not Quite Ready
Delivery address lists are rarely just clean city names. SheetXAI handles the variations alongside the geocoding.
When the city column mixes cities and ZIP codes
Some rows have city names, others have ZIP codes, others have both.
For rows in column A of the Deliveries tab that look like ZIP codes (5-digit numbers), look up city, state, county, and timezone using API Ninjas and fill columns B through E. For rows that look like city names, geocode them and write latitude and longitude into columns B and C.
When you need county data for territory assignment
Your sales territory map is defined by county, not city. You need county added to every row.
Geocode every city in column A of the Deliveries tab using API Ninjas, write latitude into column B and longitude into column C. Then for each row, also look up the county using API Ninjas and write it into column D.
When some city names are ambiguous and need a state hint
Column A has city names but no state. "Springfield" exists in forty states.
For each city in column A of the Deliveries tab, check if column B has a state code. If it does, geocode using city and state together. If column B is blank, geocode by city name alone and write "AMBIGUOUS" in column D if the result returns multiple candidates.
When the full geocoding-plus-analysis run is one prompt
Raw city list, mixed ZIP codes and city names, need coordinates, county, and a stop count per territory.
For each row in column A of the Deliveries tab, determine if it is a city name or ZIP code. Geocode appropriately via API Ninjas, writing latitude into column B and longitude into column C. Look up county and write into column D. Then create a summary table in a new tab called "Territory Summary" with a count of delivery stops per county, sorted by stop count descending.
The pattern: geocoding and territory analysis in a single prompt so you hand the ops manager the import file and the territory breakdown together.
Try It
Get the 7-day free trial of SheetXAI and open any workbook with city names, addresses, or ZIP codes, then ask SheetXAI to geocode it using API Ninjas. The API Ninjas integration is included in every SheetXAI plan. See also how to check milestone dates against public holidays in Excel or the API Ninjas in Excel overview.
