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.
- Step 1: Get your Toggl API Key
- Step 2: Create your API Request URL
- Step 3: Pull Toggl API Data into Sheets
- Step 4: Get More Data
- Log into your account on Toggl.com
- From the main dashboard, click your name > Profile Settings
- Scroll down the page until you see a section called “API Token”. Copy this to your clipboard.
- 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_tokeninto 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).
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:?email@example.com&workspace_id=3994670
You can retrieve your workspace ID by checking your URL while logged into the Toggl dashboard:
Putting it all together, we get the full API Request URL:
(Of course, you should substitute in your own email address and workspace ID).
We can now enter all our values into API Connector and start importing Toggl data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
- In the Create Request interface, enter the Request URL we just created
- Under Headers, enter a set of key-value pairs, like this:
Authorization Basic YOUR_BASE64_ENCODED_STRING
Replace YOUR_BASE64_ENCODED_STRING with your encoded string from part 1.
- 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.
- Name your request. Again we’ll call it ‘Toggl_Summary’
- Click Run and a moment later you’ll see your time stats populate the Toggl_Summary tab in your Google Sheet:
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:
Additional metrics are available for users on the paid Toggl plans.