This guide takes you from installing the Distance Calculator add-in to your first result. It takes about ten minutes, most of which is creating your Google Maps API key.
1. Install the add-in #
- In Excel, go to Home > Add-ins (or Insert > Get Add-ins), search for Distance Calculator, and click Add.
- A Distance Calculator button appears on the Home tab; click it to open the task pane.
2. Enter your license key #
- Your license key is in the purchase email from pythonandvba.com. If you do not have one yet, you can get it here.
- In the task pane, open the menu (top right) and go to Settings > Keys.
- Paste the key and click Save and check. The badge shows Valid.
3. Create and connect your Google Maps API key #
The add-in talks to Google Maps directly with your own API key, so calculations run on your Google account and we never see your data. Google gives new accounts free monthly usage that covers typical spreadsheet workloads.
- Sign in to the Google Cloud Console and create a project (any name).
- Enable these two APIs for the project: Maps JavaScript API and Routes API.
- Make sure billing is enabled on the project. Google requires it even inside the free usage tier.
- Go to APIs & Services > Credentials, click Create credentials > API key, and copy the key.
- Back in Excel, paste it under Settings > Keys and click Save and test. The badge shows Valid.
If you restrict the key to specific websites in the Google Cloud Console, allow https://addins.pythonandvba.com/*, or Excel’s requests will be rejected.
4. Run your first calculation #
Click Insert sample data, select the two address columns, check the Start and End dropdowns, and click Calculate distances. Distance and travel time are written in new columns next to your data.
Formulas #
The add-in also installs two worksheet functions:
=GMAPS.DISTANCE("New York, NY", "Boston, MA")returns the driving distance.=GMAPS.TRAVELTIME("New York, NY", "Boston, MA")returns the travel time in minutes.
Results are cached locally, so recalculating a workbook does not send new requests for address pairs it already knows.
Having trouble? #
The most common causes are a Google key without billing, a missing API on the project, or a website restriction that blocks Excel. The task pane shows a plain-language message for each of these. If you are stuck, contact support.
