Import Toggl Data to Google Sheets

Toggl is a time tracking web app that lets you track your time and productivity. In this guide, we’ll walk through how to pull time tracking data from the Toggl API directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get an API key from Toggl, and then set up a request to pull in your time tracking stats to your spreadsheet.

CONTENTS

 

STEP 1: GET YOUR TOGGL API KEY

 

  1. Log into your account on Toggl.com
  2. From the main dashboard, click your name > Profile Settings
    toggl-img1
  3. Scroll down the page until you see a section called “API Token”. Copy this to your clipboard.
    toggl-img2
  4. One last step: Because the Toggl API requires Basic Authentication, we need to encode our authentication info to base 64. You can do this by entering your your credentials in the format YOUR_API_KEY:api_token into this form, where you substitute in your own api key where it says YOUR_API_KEY, and follow it with a colon and then the string ‘api_token’. Your encoded credentials will appear underneath.

    The encoding script runs in your browser, and none of your credentials are seen or stored by this site.

     

     

    (If you have any problems with the above, please check this post for some alternate methods of encoding your credentials).

 

STEP 2: CREATE YOUR TOGGL API REQUEST URL


We’ll follow the Toggl API documentation to access your time stats.

  • API root: https://toggl.com/reports/api
  • Endpoint: /v2/summary
  • Query String:?user_agent=YOUR_EMAIL&workspace_id=YOUR_WORKSPACE_ID
    Query String Example:?user_agent=hello@mixedanalytics.com&workspace_id=3994670

You can retrieve your workspace ID by checking your URL while logged into the Toggl dashboard:
toggl-img3

Putting it all together, we get the full API Request URL:

https://toggl.com/reports/api/v2/summary?user_agent=hello@mixedanalytics.com&workspace_id=3994670

(Of course, you should substitute in your own email address and workspace ID).

 

STEP 3: PULL TOGGL API DATA INTO SHEETS


We can now enter all our values into API Connector and start importing Toggl data into Google Sheets.

  1. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  2. In the Create Request interface, enter the Request URL we just created
    toggl-img4
  3. Under Headers, enter a set of key-value pairs, like this:
    AuthorizationBasic YOUR_BASE64_ENCODED_STRING

    Replace YOUR_BASE64_ENCODED_STRING with your encoded string from part 1.
    toggl-img5

  4. Create a new tab. You can call it whatever you like, but here we’ll call it ‘Toggl_Summary’. While still in that tab, click ‘Set’ to use that tab as your data destination.
  5. Name your request. Again we’ll call it ‘Toggl_Summary’
  6. Click Run and a moment later you’ll see your time stats populate the Toggl_Summary tab in your Google Sheet:
    toggl-img6

STEP 4: GET MORE DATA

You can check the documentation for the full list of available API requests,  but if you just want to jump in, you can play around with the URLs you enter in the API URL path field. Try the following (one at a time), including your email address and workspace ID:
https://toggl.com/reports/api/v2/weekly?user_agent=YOUR_EMAIL.com&workspace_id=YOUR_ID
https://toggl.com/reports/api/v2/weekly?user_agent=YOUR_EMAIL.com&workspace_id=YOUR_ID
https://toggl.com/reports/api/v2/summary?user_agent=YOUR_EMAIL.com&workspace_id=YOUR_ID

Additional metrics are available for users on the paid Toggl plans.

Leave a Comment