The Scenario
You've been building geo-targeted rank tracking for a new client with 40 target markets. Search API requires specific location IDs to target searches accurately — not just city names, but the canonical identifier the API recognizes. You need to look those up for every market before you can build the query templates.
The alternative is doing it manually through Search API's location lookup endpoint, one city at a time, and pasting each ID into a reference column.
The bad version:
- Open Search API's location endpoint documentation, look up the first city, copy the location ID, full location name, and country code into row 2 of your sheet
- Repeat for all 40 markets
- Realize that three of your city names are spelled differently than what Search API recognizes and spend time debugging which variant returns the right match
You're the consultant on this account. Your client is paying for rank tracking to start next week. The longer the setup takes, the later the first report lands.
The Easy Way: One Prompt in SheetXAI
SheetXAI is an AI agent inside your Google Sheet. It reads your market names, understands what you need, and through its built-in Search API integration it looks up location identifiers for each city and writes the canonical ID, full location name, and country into the reference columns.
For each city name in column A, look up its Search API location ID and write the ID into column B, the full canonical location name into column C, and the country code into column D.
What You Get
- 40 rows of location reference data populated in under a minute, with Search API location ID, full location name, and country in columns B through D
- Any city name that doesn't match a canonical Search API location flagged with "not found" in column B so you can review and correct the spelling
- A complete reference sheet ready to be used as a lookup source for your geo-targeted query templates
What If the Data Is Not Quite Ready
Some of your market names in column A are ambiguous and could match multiple regions
For each city name in column A, look up the Search API location ID, prioritizing the largest metropolitan area if multiple matches exist — write the location ID, full name, country, and a note in column E if multiple matches were found and the largest metro was selected.
You have city names in column A and state or country context in column B and want to use both to resolve ambiguous markets
For each row, combine the city in column A with the region context in column B to look up the matching Search API location ID — write the ID, full canonical name, and country into columns C, D, and E.
You have 40 markets but also need location IDs for 15 zip codes listed in column F for hyper-local targeting
For each city name in column A, look up its Search API location ID and write the ID, full name, and country into columns B, C, and D — then for each zip code in column F, look up its Search API location ID and write the matching data into columns G, H, and I.
You want to look up all location IDs, cross-reference them against your existing query templates in another tab, and flag any templates that are using unrecognized location values
For each city in column A, look up the Search API location ID and write the ID and full name into columns B and C, then check the "Query Templates" tab and mark column D with "ID mismatch" for any row in that tab where the location value doesn't match a verified ID from this lookup.
Combining the reference lookup with the validation step means you catch ID mismatches before they produce silently wrong search results.
Try It
Get the 7-day free trial of SheetXAI and open your market list sheet with city names in column A, then ask it to populate location IDs from Search API for every row. Once your reference sheet is built, the geo-targeted rank research spoke shows how to put those IDs to work in live query workflows.
