Search API Connector Documentation
Import MapBox Directions Data to Google Sheets
CONTENTS
- Before You Begin
- Part 1: Get your Mapbox API Token
- Part 2: Create your API Request URL
- Part 3: Pull MapBox API data into Sheets
- Part 4: More Example API URLs
- Part 5: Limitations
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: GET YOUR MAPBOX API TOKEN
The MapBox Navigation service contains a directions API that shows you how to reach your destination. Although this API is made to pull a route on the map, a route can be pulled into the sheets giving the coordinates and geometry columns. This API can be used for:
- calculation of optimal routes for driving, walking, and cycling
- turn-by-turn instructions
- To start using the MapBox API, we will need to register on the MapBox site. After email confirmation, you will be directed to this page which contains a default public token. However, we would need to make a personal one. Click on the button Create a token.

Name your token and select all the scopes, and then save it.

Now you get your token, that you will need to run your requests!

PART 2: CREATE YOUR API REQUEST URL
To create API requests, we will use some examples provided in the MapBox Directions API documentation.
- API root: https://api.mapbox.com/directions/v5/
- Profiles:
- mapbox/driving-traffic
- mapbox/driving
- mapbox/walking
- mapbox/cycling
To retrieve directions you should use following API link:
GET https://api.mapbox.com/directions/v5/{profile}/{coordinates}?access_token=YOUR-TOKEN
Please note: In order to retrieve directions you must specify at least two waypoints as starting and ending points.
PART 3: PULL MAPBOX API DATA INTO GOOGLE SHEETS
Now, let’s find a route between two points! In this example, we will pull a cycling route between two endpoints (-122.42, 37.78) and (-77.03, 38.91).
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create tab, enter the API URL constructed like this:
https://api.mapbox.com/directions/v5/mapbox/cycling/-122.42,37.78;-77.03,38.91?access_token=ENTER-YOUR-TOKEN

3. Now create a new tab, give it a name and click Set current to use that tab as your data destination.

4. Give a name to your request and click run!

5. And now you should be able to see the pulled data!

PART 4: MORE EXAMPLE API URLS
We encourage you to go through the provided documentation and explore more ways to pull the data, using optional parameters.
- Request to access speed limit information using the max speed annotation between 3 passed pair of coordinates using the driving profile:
https://api.mapbox.com/directions/v5/mapbox/driving/-122.39636,37.79129;-122.39732,37.79283;-122.39606,37.79349?annotations=maxspeed&overview=full&geometries=geojson&access_token=YOUR-API-TOKEN
- Request a walking route between two locations:
https://api.mapbox.com/directions/v5/mapbox/walking/-122.42,37.78;-122.92,37.18?access_token=YOUR-API-TOKEN
- Request directions with radiuses and a polyline response through multiple waypoints:
https://api.mapbox.com/directions/v5/mapbox/driving/13.43,52.51;13.42,52.5;13.41,52.5?radiuses=40;;100&geometries=polyline6&access_token=YOUR-API-TOKEN
- Request a route that approaches the destination on the curb of the driving side:
https://api.mapbox.com/directions/v5/mapbox/driving/13.43,52.51;13.43,52.5?approaches=unrestricted;curb&access_token=YOUR-API-TOKEN
- Specify a departure time:
https://api.mapbox.com/directions/v5/mapbox/driving/-122.396112,37.791399;-122.433904,37.757812?access_token=YOUR-API-TOKEN&depart_at=2021-05-05T15:00
- Specify waypoints:
https://api.mapbox.com/directions/v5/mapbox/driving/13.43,52.51;13.42,52.5;13.43,52.5?waypoints=0;2&access_token=YOUR-API-TOKEN
PART 5: LIMITATIONS
- Requests using the driving, walking, and cycling profiles can specify up to 25 total waypoints along the route.
- Requests using the driving-traffic profile can specify up to 3 waypoints along the route.
- Maximum 300 requests per minute.
- Maximum total of 10,000 kilometers between all waypoints.