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

Calculate Driving Distance and Time for Address Pairs in a Google Sheet

2026-05-15
5 min read

The Scenario

You're the field sales manager and it's the end of the month. Finance wants mileage reimbursement data for 12 reps, and the source is a Google Sheet where each row is one client visit — rep's home address in column A, client address in column B, 200 rows total. Reimbursement is calculated on actual driving distance, not straight-line. You need driving distance in km and travel time in minutes added to every row before you can hand this to payroll.

The bad version:

  • Open Google Maps, enter the first rep's address, add the client address, read the driving distance and time, type them into columns C and D
  • Do that 200 times
  • Discover at row 140 that you accidentally entered two addresses in the wrong order, so rep 8's distances are all off by a factor of three because her home is 180km from the office but her clients are all local

Payroll closes Friday. You have 200 rows and no script.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Google Sheet. It reads the origin and destination address pairs, calls TomTom route calculation for each row, and writes the distance and duration results back into the sheet.

For each row in this sheet where column A is an origin address and column B is a destination address, calculate the TomTom driving route and write the total distance in km and travel time in minutes into columns C and D

What You Get

  • Column C: driving distance in km for that origin-destination pair
  • Column D: travel time in minutes
  • Blank where TomTom couldn't resolve one of the addresses — so you can spot and fix bad rows before payroll processes them

What If the Data Is Not Quite Ready

Some address fields have inconsistent formatting

For each row, clean up the addresses in columns A and B by stripping any extra commas or apartment numbers, then calculate the TomTom driving route and write distance in km and travel time in minutes into columns C and D. Flag any row where TomTom returned no result in column E.

Routes are multi-stop (rep visited several clients in sequence)

Calculate the driving route between each consecutive address in column A of my sheet, treating rows as a multi-stop journey. Write the leg distance in km and travel time in minutes for each segment into columns B and C. Write the total journey distance in cell D1.

Only process rows for a specific rep

For all rows in this sheet where column C says "Region West", calculate the TomTom driving route between the origin in column A and the destination in column B. Write driving distance in km into column D and travel time in minutes into column E.

Full reimbursement calculation in one pass

For each row, calculate the TomTom driving distance between the address in column A and the address in column B. Write the distance in km into column C and the travel time in minutes into column D. Then calculate the reimbursement amount as distance times the rate in cell F1 and write it into column E. Sum column E and put the total in cell E1.

One prompt runs the routing, writes the distances, applies the rate, and produces the total.

Try It

Get the 7-day free trial of SheetXAI and open the Google Sheet with your rep visit data, then ask it to calculate driving routes using TomTom. For submitting a large batch all at once rather than row by row, see the batch routing spoke.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more