Post

My First Gist in Github: Python script to transfer Clockify time entires to Toggl Track

Hi

Why?

So, These apps have great functionality

Toggl has a better idle tracking and a activity tracking which help enter my time-entry when I forgot to start the timer (a timeline in Calendar section of PC app) BUT Toggl is not accessible in Iran due to Google CDN blockage.

On the other hand, Clockify is more feature full: Tasks, better CDN (Amazon) for me as an Iranian user, More handy export….. BUT it does not have that Calendar view like Toggl and some other tiny feeature, so I decided to use both for different purposes!

I’ve just shared my first Gist on Github:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pandas as pd
from sys import argv

input_csv_path = argv[1]

df = pd.read_csv(input_csv_path)

## Create column mapping dictionary
column_mapping = {'Category': 'Client',         ## <- if you have not changed settings in Clockify, remove this entry
                  'Duration (h)': 'Duration',
                  'Start Date': 'Start date',
                  'Start Time': 'Start time',
                  'End Date': 'End date',
                  'End Time': 'End time',
                  'Billable Amount (USD)': 'Amount (USD)'
                 }

## Rename columns
df.rename(columns=column_mapping, inplace=True)

## Remove columns based on their names
columns_to_remove = ['Group', 'Billable Rate (USD)', 'Duration (decimal)']
df.drop(columns=columns_to_remove, inplace=True, errors='ignore')

## Write to a new CSV file
output_csv_path = argv[2]
df.to_csv(output_csv_path, index=False)

Using this code, You can transfer your time entries from Clockify to Toggl Track using Export and Import functionality of these tools

Usage

1
python3 converter.py path/to/clockify_export.csv path/to/output.csv

Notes

  1. I’ve changed settings in Clockify to show “Categories” instead of “Clients”, so if you did NOT do the same, remove 'Category': 'Client', from column_mapping
  2. My display format in Clockify set to “YYYY-MM-DD”, change yours to this or you will encounter and error while importing to Toggl Track (Toggl Track format in my setting, set to “DD/MM/YYYY” which is not important as I tested)

Good luck

This post is licensed under CC BY 4.0 by the author.