Trello Time Tracker Script

I’ve long been an advocate for using Trello to organise your workflow. I personally use it in my day job, for freelance work, and for church events. However, lately I’ve also been using Trello as a timesheet – this is particuarly useful for any freelance work where clients want to see what you’ve been working on.

I can setup time tracking easily thanks to the new Custom Fields Power Up, and a simple PHP script.

It’s worth mentioning that there are a few other options for Time Tracking in Trello. There are plenty of third-party apps which can integrate with Trello to add this feature. However, for my simple requirements (tracking hours and generating a report) they are a little heavy-weight.

Setup Your Custom Field

If you haven’t already, create a Trello board and enable the Custom Fields Power Up. Free users of Trello can enable one Power Up per board. It’s a tight restriction, but I think this one is worth it for this feature.

My system relies on a single Custom Field. Because most of my freelance work is Software Development, I usually call this field “Development Time (Hrs)” – but you can name it anything you like. This field will contain the number of hours (decimal values are okay) you have worked on the contents of a card.

When this field has been setup, you can access it on any Card. Simply open up a card, and click the “Custom Fields” button. Your newly configured field now displays, ready for you to enter some data into.

When I’m working, I keep updating this field with the total number of hours worked on the job. Cards usually represent a small unit of work, so hopefully it doesn’t get too large. I also sometimes use comments to help me track the progress over time.

The value of this field is also visible from the card overview:

Getting a timesheet

For small projects, you can simply add-up the value of each card and write up an invoice. For larger projects, or ongoing contracts, this becomes time-consuming.

I ran into this problem very quickly, so decided to write a little script. The script requires a web server with PHP. If you have LAMP, XAMPP, MAMP, WAMP, or any of the other variants then that will do.

Caution: This script is very simple and does not provide for any authentication. Do not place it on a public-facing website. Use localhost.

1. Download the Script

Download the PHP script and put it on your web server someplace.

2. Configure the script

There are a few configuration fields at the top of the file:

These fields are fairly self-explanitory.

$CONFIG_TimeFieldName allows you to specify the name of the custom field you setup on your Trello board.

$CONFIG_TimeBilled allows you specify the number of hours you have already billed for this client. It will be subtracted from the total, and also provided in the breakdown on the timesheet.

$CONFIG_TimeRate allows you to specify how many dollars per hours you charge.

$CONFIG_TimeTarget lets you specify how many hours you are allowed to spend on this project in total (or until the end of this billing cycle). This helps you see quickly how you are tracking.

3. Provide the data from Trello

Trello allows you export your entire board as a JSON file. We use this JSON file as the datasource for the timesheet. To find the data, go to Menu > More > Print and Export > Export JSON.

  

Save this file in the same directory as your PHP script and call it “data.json”.

4. Run the script

In a web browser, navigate to the TrelloTimeTracker.php script. If all went well, you’ll see the output of your timesheet. It includes a line-by-line breakdown of all cards, as well as a summary at the bottom.

Here’s an example of the output:

I can hear you saying “ugh, that’s a bit ugly”. And you’re right. My script comes with no default styling. In fact, it’s a very basic little utility.

This tool is perfectly usable as-is, but you may wish to improve it or integrate it with your other systems.

You may wish to integrate this with you internal Intranet. Perhaps you’d like to use the Trello API to automatically pull the data. I’ve deliberately kept this script simple so you can make it your own.

Get the Broadcast Technology Newsletter

Sign up for the email newsletter about media and technology. Sent irregularly. No spam.

I'm Anthony Eden, and I'm a broadcast technologist. I've been working in broadcast media since 2008 (getting my start in Community Radio while still at school), and developing software and websites for just as long. Right now, I work full time for Hope Media, and provide some freelance services through Media Realm.

Follow Anthony on Twitter: @anthony_eden or Google+