The Scenario
The cost-estimation model your logistics team built depends on flight distances — kilometres between origin and destination airports — for sixty route pairs. The pairs are already in your Google Sheet: column A is the origin IATA code, column B is the destination IATA code. Column C is empty. The model has been waiting on those distances for three days because the person who was supposed to pull them manually left for another team and the handoff was incomplete.
The bad version:
- Track down the APIVerve flight distance endpoint documentation, which is buried three levels into the API catalogue.
- Realise the endpoint takes IATA codes as query parameters and you need to construct a separate URL for each of the 60 route pairs.
- Build or borrow a script, run it, parse the response objects, extract the distance field, and paste 60 values into column C in the right order.
The model cannot go live until this column is filled. The team behind it is waiting on you. There is no budget for a developer to write a one-off enrichment script.
The Easy Way: One Prompt in SheetXAI
SheetXAI is an AI agent that lives inside your Google Sheet. It reads your column headers and data, and through its built-in APIVerve integration it can look up the flight distance for every IATA pair in the sheet and write the results into column C — no endpoint configuration required.
Look up the flight distance for each route in my sheet using the IATA codes in columns A and B and put the km distance in column C
What You Get
- Column C filled with flight distances in kilometres for all 60 route pairs.
- Each distance sourced from the APIVerve flight data endpoint using the exact IATA codes in columns A and B.
- Rows with unrecognised or invalid IATA codes noted in column C rather than left silently blank.
- The cost-estimation model unblocked without a developer handoff.
What If the Data Is Not Quite Ready
Some IATA codes have extra spaces or are lowercase
Trim and uppercase all values in columns A and B, then look up the flight distance for each route pair using APIVerve and write the result in km to column C
A handful of rows use airport names instead of IATA codes
For rows in columns A and B where the value looks like an airport name rather than a 3-letter code, try to resolve the IATA code from the name, then look up the flight distance and write it to column C; flag any rows you couldn't resolve with a note
The sheet has duplicate route pairs that need deduplication first
Identify any duplicate origin/destination pairs in columns A and B, mark duplicates with "DUPLICATE" in column D, then for the unique pairs look up the flight distance from APIVerve and write the km value to column C
Kill-chain prompt — validate, enrich, and flag outliers
Trim and uppercase IATA codes in columns A and B, deduplicate routes (mark extras in column D), look up the flight distance for each unique pair using APIVerve and write to column C, then flag any route with a distance over 10,000 km in column E as "Long-haul review"
Cleanup and enrichment belong in the same prompt — there's no reason to run them as separate passes.
Try It
Get the 7-day free trial of SheetXAI and open your route sheet with IATA pairs in two columns, then ask SheetXAI to fill in the flight distances. You might also want to pull current weather for your distribution cities or check the full APIVerve integration overview.
