This blog is a step-by-step guide on creating a timesheet in Notion using database buttons.
You'll be able to keep track of the time spent on each task by clicking a button to start recording time and another to pause recording. You'll be able to see the time spent on each time and the total time spent working on a project.
βDon't have time to create the timesheet yourself? Buy the ready-made template for $5 hereβ
There is an accompanying YouTube video π
Step 1 - Create the databases
-
Open a blank Notion page
-
Add an inline database called Tasks
-
Add another inline database called Timesheet
-
delete the Tags properties in each database
-
In the Tasks database add a new relation property, with the following settings:
-
Related to: Timesheet
-
Show on Timesheet: switch on
-

-
The relation property should now show on each database.
-
In the Timesheet database add the start and end date properties - used to record time.
-
Add a new Date property called Start
-
Add another Date property called End
-
-
Your Notion page should now look like this π

Adding Database Buttons to Record Time
The next stage is to add the buttons to the Tasks database, they will be used to start and pause the time recording for each task.
The Work Button
-
Add a new Button property to the Tasks database
-
Name the button Work and select an icon
-
You can give the button a label using emoji's, like this π
-

This button will create a new timesheet record and set the start property the timesheet record to the time and date you clicked the button.
-
Click on Add action
-
Select Add page to...
-
Select the Timesheet database

-
Select the Start property
-
Set the property to Now

-
Click Edit another property
-
Select the Tasks relation property
This relates the new timesheet record to the task you clicked the work button for.

The Pause Button
This button will pause recording the time on a task by giving active timesheets an end date.
Note: because of a current limitation with Notion's button functionality you cannot select only the timesheet record related to a task. So the pause button will pause all active timesheets without an end date.
-
Add a new Button to the Tasks database
-
Name the button Pause and select an icon
-
Add a label
-
Click on Add action
-
Select Edit pages in...
-
Select the Timesheet database
-
Click on the all pages dropdown
-
Select the
-
We only want to edit pages in the Timesheet database that do not have an end date - so we have to set a filter for this
-
Continue editing the button:
-
Click on the all pages dropdown
-
Select the End property
-
Select Is Empty (in the third box from the left)
-

-
Select the End property
-
Set the value to Now

Calculating Time
Next we are going to create a set of properties that record the time spent on each task. Starting with a property on the Timesheet database that calculates the time spent for each timesheet record.
Note: Notion formulas are case sensitive, so when you are creating the properties make sure the property name is exactly the same as written in the blog. If they aren't you won't be able to copy and paste the formulas into Notion the formulas won't work when you copy and paste them into your Notion.
Calculating Time for Each Timesheet Record
-
Add a new Formula property to the Timesheet database
-
Name it Time (minutes)
-
Copy the formula below and paste it into the formula edit page
if(empty(prop("End")),dateBetween(now(),prop("Start"),"minutes"),dateBetween(prop("End"),prop("Start"),"minutes"))
-
The formula will look like this when you paste it into Notion π

β οΈ If the End and Start properties aren't highlighted in grey in your Notion, this means that the properties cannot be found. Make sure you have created them and named them correctly.
Calculating the Total Time Spent on each Task
The next formula will calculate the total time spent on each task by summing all the associated timesheet records.
-
Add a Formula property to the Tasks database
-
Name the Formula Time (minutes)
-
Copy the formula below and paste it into the formula edit page
map(prop("Timesheet"), current.prop("Time (minutes)")).sum()
-
The formula will look like this when you paste it into Notion π

Add some tasks and test the buttons. Your databases should look something like this:

Converting the Time to Hours and Minutes
We now have the total time spent on each task in minutes, but it's better to have the time in hours and minutes. The next formula shows you how to create this.
-
Add a formula property to the Tasks database
-
Name the formula Total Time
-
Copy the formula below and paste it into the formula edit page
(prop("Time (minutes)")/60) == 0 ? "00:00" : format(floor(prop("Time (minutes)")/60)) + "hr " + format((prop("Time (minutes)"))- (floor(prop("Time (minutes)")/60) *60)) + "mins"
The formula will look like this when you paste it into Notion π

-
Repeat this step and add the same Total Time formula to the Tasks database
Adding a Completed Button
The next step is to add a completed button to the Tasks database so you can automatically set the end date of a task.
-
Add a date property the Tasks database and name it End Date
-
Add a button property to the Tasks database
-
Name it Completed and add an icon
-
You can give the button a label using emoji's, like this π
-

The button will give the task an end date
-
Click on Add action
-
Select This page
-
Set the End Date to Today

Test that the button works and the task is given today as the end date.
Add the Timesheet Status Property
At the moment you don't know if you're recording time against a task, unless you look at the timesheet and see which records are running. The next step will add a status property that works out if you're recording time against a task, have paused time or if the task is completed. It'll even give some warning messages.
-
Add a new formula property to the Tasks database
-
Name the property Timesheet Status
-
Copy the formula below and paste it into the formula edit page
ifs(empty(prop("End Date"))==false and map(prop("Timesheet"),current.prop("End")).filter(empty(current)).length() > 0,"6. Completed with open time recording! β οΈ",empty(prop("End Date"))==false,"4. Completed β ",empty(map(prop("Timesheet"),current)),"1. Not Started β",map(prop("Timesheet"),current.prop("End")).filter(empty(current)).length() == 1,"3. Running β±οΈ",map(prop("Timesheet"),current.prop("End")).filter(empty(current)).length() > 1,"5. More than 1 timesheet recording time! β οΈ","2. Paused βΈοΈ")
The formula will look like this when you paste it into Notion π

π©βπ«Explanation:
The formula uses the ifs() function - here is the logic to explain what the formula is doing.
-
If the task has an end date but there is an open timesheet running against the task
-
The value is set to "6. Completed with open time recording! β οΈ"
-
-
If the task has an end date and there are no open timesheet running
-
The value is set to "4. Completed β "
-
-
If the task has no timesheet records
-
The value is set to "1. Not Started β"
-
-
If the task has 1 open timesheet
-
The value is set to "3. Running β±οΈ"
-
-
If the task has more than 1 open timesheet
-
The value is set to "5. More than 1 timesheet recording time! β οΈ"
-
-
For all other instances
-
The value is set to "2. Paused βΈοΈ"
-
You can change the values set for each option
Start Date Formula
This property calculates the start date of a task by retrieving the start date of the task's first timesheet:
-
Add a Formula property to the Tasks database
-
Name the property Start Date
-
Copy the formula below and paste it into the formula edit page
map(prop("Timesheet"),current.prop("Start")).sort().first()
The formula will look like this when you paste it into Notion π

Optional Projects Database
Follow these steps if you want to link tasks to a project and track the total time spent on each project
-
Create an inline database called Projects
-
Add a Relation property and link it to the Tasks database
-
Make sure you select Show on Tasks

-
Add a Formula property to the Projects database
-
Name it Time (minutes)
-
Copy the formula below and paste it into the formula edit page
map(prop("Tasks"),current.prop("Time (minutes)")).sum()
The formula will look like this when you paste it into Notion π

-
Add a Formula property to the Projects database
-
Name it Total Time
-
Copy the formula below and paste it into the formula edit page
format(floor(prop("Time (minutes)")/60)) + "hr " + format(prop("Time (minutes)")- (floor(prop("Time (minutes)")/60) *60)) + "min"
The formula will look like this when you paste it into Notion π

Test this is working by going to the Tasks database and associating each task with a project. The tasks times will be summed and added to the total time for the projects