Print

Import Clockify Data to Google Sheets

In this guide, we’ll walk through how to pull data from the Clockify API directly into Google Sheets, using the API Connector add-on for Sheets.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your Clockify API Key

  1. Log in to Clockify.me and click Settings in the left-hand sidebar
    clockify-settings
  2. Scroll down to the API section and click Generate
    clockify-generate
  3. You should now see your key. Keep it handy as you'll need it in a moment. Congrats! You're now ready to use the Clockify API.

Part 2: Pull Clockify API Data into Sheets

Example #1

For this first example, we'll get a list of our available workspaces, since we'll need the workspace IDs for subsequent requests.

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodGET
    • Request URLhttps://api.clockify.me/api/v1/workspaces
    • Headers
      • x-api-key: your_api_key
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run. A moment later you’ll see data populate your sheet.
    clockify-response-workspaces

Note the workspace IDs returned in column A, and the user Ids in column G.

Example #2

We'll now fetch a detailed time report. Substitute in the workspace ID where it says your_workspace_id.

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodPOST
    • Request URLhttps://reports.api.clockify.me/v1/workspaces/your_workspace_id/reports/detailed
    • Headers
      • x-api-key: your_api_key
      • Content-type: application/json
    • Request body: {"dateRangeStart":"2023-08-01T00:00:00.000Z","dateRangeEnd":"2023-08-31T23:59:59.000Z","detailedFilter":{"page":1,"pageSize":1000,"options":{"totals":"EXCLUDE"}}}
  3. Create a new tab and click Set current to use that tab as your data destination.
  4. Name your request and click Run.
    clockify-reportdetail

Part 3: Handle Pagination

Clockify limits the number of records at a time based on the pageSize parameter. To get more, we'll need to paginate through multiple pages of data. The pagination type depends on the endpoint:

Report endpoints

Fetching data from the /reports/detailed, /reports/summary, or /reports/weekly endpoints requires paginating with parameters in the request body:

  • Type: page parameter body
  • Page body parameter: detailedFilter.page
  • Run until: choose when to stop running the request
    clockify-pagebodypagination


Other endpoints

Other endpoints paginate through the request URL, and can use API Connector's "page parameter" pagination type like this:

  • Pagination type: page parameter
  • Page parameter: page
  • Run until: choose when to stop fetching data
    clockify-pagination

Part 4: API Documentation

Official API documentation: https://docs.clockify.me/

Leave a Comment

Jump To