Search API Connector Documentation
Import MapBox Data to Google Sheets
MapBox provides four different services: Maps, Navigation, Search, and Accounts. All services are accessed in a similar way, but this tutorial focuses on the Mapbox Navigation API. It shows how to fetch data directly into Google Sheets using the API Connector add-on for Sheets.
- Before You Begin
- Part 1: Get your Mapbox API Token
- Part 2: Pull MapBox API data into Sheets
- Part 3: More Example API URLs
- Part 4: Documentation
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 Google Sheets containing the coordinates. This API can be used for calculation of optimal routes for driving, walking, and cycling, as well as turn-by-turn instructions.
- If you haven't already, register an account on the MapBox site. After email confirmation, you will be directed to this page which contains a default public token. Create a new private token by clicking Create a token.
- Name your token and select the scopes for which you'd like access, and then save it.
- You'll now see your token; copy it as we'll use it shortly.
Part 2: Pull Mapbox API Data into Google Sheets
For this example, we'll find a cycling route between two points (-122.42, 37.78) and (-77.03, 38.91). Enter your token where it reads
- Open up Google Sheets and click Extensions > API Connector > Open > Create request.
- In the request form enter the following:
- Request URL:
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see data populate your sheet.
Part 3: More Example URLs
The documentation contains the full array of available endpoints and parameters, but check the examples below to get started.
- Request to access speed limit information using the max speed annotation between 3 passed pair of coordinates using the driving profile:
- Request a walking route between two locations:
- Request directions with radiuses and a polyline response through multiple waypoints:
- Request a route that approaches the destination on the curb of the driving side:
- Specify a departure time:
- Specify waypoints:
Part 4: API Documentation
Official API documentation: https://docs.mapbox.com/api/navigation/directions/