Import Toggl Data to Google Sheets
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.
- Before You Begin
- Part 1: Get your Toggl API Key
- Part 2: Create your API Request URL
- Part 3: Pull Toggl 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 TOGGL API KEY
- 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).
PART 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
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:
Just substitute in your own email address and workspace ID.
PART 3: PULL TOGGL API DATA INTO SHEETS
Now let’s enter our URL into API Connector and import Toggl 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 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 and click ‘Set current’ to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see your time stats populate the Toggl_Summary tab in your Google Sheet:
STEP 4: MORE EXAMPLE API URLS
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.