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

Build a Travel Time Matrix From Depot and Delivery Addresses in a Google Sheet

2026-05-14
5 min read

The Scenario

The dispatch team at a last-mile delivery company has 20 depot addresses and 100 customer stops loaded into a Google Sheet from this morning's order feed. Their routing software needs a travel time matrix — every depot to every customer, in minutes — before the drivers can be assigned. The person who used to generate that matrix with a custom script left last month. The script is somewhere on a server nobody can log into.

The bad version:

  • Find a route matrix API, figure out the request format for an origin-destination matrix, and either write a new script or find an existing tool that can handle 20x100 pairs.
  • Discover that the API returns the matrix in a flattened JSON array indexed by position, and spend an hour writing the logic to expand it into a grid that matches the sheet's row and column layout.
  • Paste the result into a new sheet, realize the row order doesn't match the original depot list, and manually re-sort 2,000 cells.

Drivers are supposed to leave the depot at 7 AM. The matrix needs to be in the routing tool before then, and it is currently 5:30 AM.

The Easy Way: One Prompt in SheetXAI

SheetXAI is an AI agent that lives inside your Google Sheet. It reads both address lists, calls Geoapify's route matrix API, and writes the resulting travel time and distance values into the correct cells — structured as a grid the routing tool can consume.

Use Geoapify to compute a route matrix between all depot addresses in the Depots tab and all customer addresses in the Customers tab, and write the travel time in minutes into a new matrix sheet

What You Get

  • A new sheet is created with depots along rows and customer stops along columns.
  • Each cell contains the driving travel time in minutes between that depot-customer pair.
  • Column and row headers match the original address identifiers so the routing tool can join them without manual reindexing.

What If the Data Is Not Quite Ready

Addresses need geocoding before the matrix can be computed

Geocode all depot addresses in the Depots tab and all customer addresses in the Customers tab using Geoapify — then compute a driving time matrix between all pairs and write the result into a new Matrix sheet

The matrix should show both distance and time, not just time

Calculate driving distance in km and travel time in minutes from each depot in column A to each customer stop in column B using Geoapify route matrix — write distance into column C and time into column D for each pair

Only compute the matrix for stops assigned to a specific region flag

Filter the customer rows in the Customers tab to only those where the Region column equals North, then compute a Geoapify travel time matrix between all depot addresses and those filtered customers, and write the results into the North Matrix sheet

Geocode addresses, compute the full matrix, and flag any depot-customer pairs where travel time exceeds the SLA threshold

Geocode both address lists in the Depots and Customers tabs using Geoapify, compute a full driving time matrix, write it into a new Matrix sheet, and flag any cell where travel time exceeds 45 minutes in red so the dispatch team can see SLA risks at a glance

All four steps run in a single instruction — no intermediate exports or manual joins.

Try It

Get the 7-day free trial of SheetXAI and open any sheet with origin and destination address lists — whether it is depot-to-customer, hub-to-hub, or field-team-to-site — and ask it to build the matrix. See the sibling spoke on optimizing multi-stop delivery routes, or return to the Geoapify hub.

Stop memorizing formulas.
Tell your spreadsheet what to do.

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

Learn more