Import KoBoToolbox Data to Google Sheets
In this guide, we’ll walk through how to pull Kobo API data directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get an API key from Kobo, and then set up a request to pull in data to your spreadsheet.
CONTENTS
- Before You Begin
- Part 1: Get your Kobo API Key
- Part 2: Create your API Request URL
- Part 3: Pull Kobo API Data into Sheets
- Part 4: More Example API URLs
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: GET YOUR KOBO API KEY
- While logged in to your Kobo account, check the domain in the address bar. For most people, this will be either kf.kobotoolbox.org or kobo.humanitarianresponse.info (this article describes the difference).
- Now navigate to https://YOUR_DOMAIN/token, i.e. https://kf.kobotoolbox.org/token/ or http://kobo.humanitarianresponse.info/token. Copy the token that you see there. That’s it, you can now access Kobo’s API.
PART 2: CREATE YOUR KOBO API REQUEST URL
We’ll follow the Kobo API documentation to get a list of your assets.
- API root: https://YOUR_DOMAIN/api/v2/ (https://kf.kobotoolbox.org/api/v2/ or kobo.humanitarianresponse.info/api/v2/)
- Endpoint: /assets.json
Putting it all together, we get the full API Request URL:
https://kf.kobotoolbox.org/api/v2/assets.json
PART 3: PULL KOBO API DATA INTO SHEETS
We can now enter all our values into API Connector import Kobo API data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create screen, enter the Request URL we just created
- Under Headers, enter two sets of key-value pair like this:
Authorization Token YOUR_API_TOKEN Accept application/json Replace YOUR_API_TOKEN with the token you got in the first part.
- We don’t need OAuth2 authentication so just leave that set to None. 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 a list of your Kobo assets (forms/projects, questions, blocks, templates, collections) populate your sheet.
PART 4: MORE EXAMPLE API URLS
Since Kobo hasn’t provided much documentation, this post in the community forum seems to be the best place for more information. Besides that, you can try the following:
- View all public collections
https://YOUR_DOMAIN/api/v2/collections/?all_public=true - View private collections
https://YOUR_DOMAIN/api/v2/collections - View user metadata
https://YOUR_DOMAIN/api/v2/users/{username} - View permissions
https://YOUR_DOMAIN/api/v2/permissions - View details of a specific survey
https://YOUR_DOMAIN/api/v2/assets/{asset uid} (get the uid from the /assets endpoint) - View submitted data
https://YOUR_DOMAIN/api/v2/{asset_uid}/data/ - Create or view data exports
https:/YOUR_DOMAIN/exports/