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

PART 1: GET YOUR KOBO API KEY

  1. 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).
    kobo-img1
  2. 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.
    kobo-img2

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.

  1. Open up Google Sheets and click Add-ons > API Connector > Open.
  2. In the Create screen, enter the Request URL we just created
    kobo-img3
  3. Under Headers, enter two sets of key-value pair like this:
    AuthorizationToken YOUR_API_TOKEN
    Acceptapplication/json

    Replace YOUR_API_TOKEN with the token you got in the first part.

    kobo-img4
  4. 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.
  5. 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.
    kobo-img5

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/ 

Leave a Comment