Back to APIVerve in Excel
SheetXAI logo
APIVerve logo
APIVerve · Excel Guide

Enrich Airport Route Pairs With Flight Distances in a an Excel workbook

2026-05-14
5 min read

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 Excel workbook: 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 Excel workbook. 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 and write the results into column C — no endpoint configuration required.

For every origin/destination airport pair in my Excel table, fetch the flight distance from APIVerve and add it to column D

What You Get

  • Column D 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 D 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 D

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 D; flag any rows you couldn't resolve with a note

The workbook 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 E, then for the unique pairs look up the flight distance from APIVerve and write the km value to column D

Kill-chain prompt — validate, enrich, and flag outliers

Trim and uppercase IATA codes in columns A and B, deduplicate routes (mark extras in column E), look up the flight distance for each unique pair using APIVerve and write to column D, then flag any route with a distance over 10,000 km in column F 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 workbook 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.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more