Members-only tutorial
Watch the video and get the practice sheet with membership.
About this Tutorial
Sheet Resources
Video Transcript
<div>00:00 Hello, Better sheets members. We're gonna create a timer today. So a timer's a cool thing to have with a Google sheet because essentially what we get to do is we can create Pomodoro timers, we can create sort Learn how to sort data effectively in Google Sheets. Opens in new tab of timed tests or we can just see how long we've taken for certain tasks.<br>00:24 There's some limitations. So we have to work around those limitations.
App script Discover the power of Apps Script for automating tasks. Opens in new tab is really cool and offers us the ability to sort Learn how to sort data effectively in Google Sheets. Opens in new tab of insert a timestamp Understand how to work with timestamps in your sheets. Opens in new tab , right?<br>00:35 We have the now function Get to know functions and how they enhance your spreadsheets. Opens in new tab , which gives us this timestamp Understand how to work with timestamps in your sheets. Opens in new tab , and we have we can sort Learn how to sort data effectively in Google Sheets. Opens in new tab of keep putting nows and we can also do com command C copy.<br>00:49 And then piece to value, we get this date, right? This 44 8 8 1 0.26 of where Explore the query where clause for advanced data filtering. Opens in new tab ? 26 and a half percent through the day, right?<br>01:01 Cas Wow. From midnight to midnight.
So this gives us a hard coded time if we, you know, copy and paste values Learn how to paste values without formulas in Google Sheets. Opens in new tab , but we don't really wanna do that with this equals now.<br>01:17 And now we have these two things, right, These two times and a start time and an end time, and we can subtract them.<br>01:29 We just need to format Master formatting techniques to improve your sheet's appearance. Opens in new tab this properly. So let's format Master formatting techniques to improve your sheet's appearance. Opens in new tab this as a time. No, that's not it. Format Master formatting techniques to improve your sheet's appearance. Opens in new tab number Understand number formatting options in Google Sheets. Opens in new tab , duration.<br>01:40 So this has been five seconds between these two things. So this is cool, right?
We have the ability in Google Sheets to do this math.<br>01:52 We can make a little bit of a start and we can time different events. Let's put this all sort Learn how to sort data effectively in Google Sheets. Opens in new tab of magically together, Not magically, but together.<br>02:05 This subtraction, we could add like an if is blank little magic thing here. If c2 Think It's D two. Well, let's say just if, if D two is blank, right?<br>02:35 There we go. So now if this doesn't exist, this, the time doesn't exist, the duration we can do equal now in copy and paste values Learn how to paste values without formulas in Google Sheets. Opens in new tab so that this duration doesn't end.<br>02:53 That's been two minutes.
Again, we can format Master formatting techniques to improve your sheet's appearance. Opens in new tab this. Let's format Master formatting techniques to improve your sheet's appearance. Opens in new tab it before, before you go crazy. Need time. There we go.<br>03:04 So we have these timestamps, we have the duration, essentially have a timer here already, but it's a pretty crappy timer because we have to sort Learn how to sort data effectively in Google Sheets. Opens in new tab of keep putting the start in, keep putting the end in.<br>03:18 Wish we could do that programmatically. So let's do that with a couple things. Let's move these down. Let's put check boxes here.<br>03:31 Insert check box. We're gonna do the same here.
So if we click this start, we want this timestamp Understand how to work with timestamps in your sheets. Opens in new tab to start.<br>03:41 If we click this checkbox Utilize checkboxes for interactive elements in your sheets. Opens in new tab , we want this end to have a timestamp Understand how to work with timestamps in your sheets. Opens in new tab . This timestamp Understand how to work with timestamps in your sheets. Opens in new tab has to not be the equal.<br>03:51 Now function Get to know functions and how they enhance your spreadsheets. Opens in new tab need to actually be a timestamp Understand how to work with timestamps in your sheets. Opens in new tab . So let's go into our app script Discover the power of Apps Script for automating tasks. Opens in new tab and start doing this, right? We have, We know we wanna click on C1 and D one.<br>04:01 We want C3 and D three to be where Explore the query where clause for advanced data filtering. Opens in new tab we put attempts down. Okay? We have a function, my function here.<br>04:08 Let's change this to oned. And then we have an event E.
And we're gonna do if basically E range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab get row is equal to one e range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab dot, it's gonna be e get sheet, be e get sheet dot get name.<br>04:47 So we should be able to get the name of the sheet that the edit is happening on with this e dot range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab .<br>04:53 Do get sheet do get name, and you can always log it to check if that is actually occurring. And we want to make sure that that is equal to sheet one, which is the name of the sheet.<br>05:07 So sheet one, C one and D one. We want the range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab E road get row to be just in the first row for right now.<br>05:22 We'll just do that.
Actually no, we want two ifs. We want and e range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab dot get column can always again log this to double check that we're getting the right thing.<br>05:44 We wanna log the row and the column Should be, we wanna make sure the column is equal to, what is it?<br>05:55 C1 is gonna be three C. So if that happens, then we have another. If, if it's column four, we want to put in the timestamp Understand how to work with timestamps in your sheets. Opens in new tab .<br>06:07 So with timestamp Understand how to work with timestamps in your sheets. Opens in new tab it's just gonna be variable time. We'll just do time, Which I'll Be, we can do it in here.<br>06:18 Variable time start is equal to new date and that's it.
Just new date with this capital D and parenthesis, this is a timestamp Understand how to work with timestamps in your sheets. Opens in new tab .<br>06:28 And then we wanna do time end here. First off, let's double check that this range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab is all working correctly. So if we just do a couple of edits here, go to our executions, we go to our last execution and see sheet one.<br>06:50 That's correct, those my face, click refresh. Hmm, <affirmative>. And there we go. We got one in four. So we are getting the correct row and the correct column with our app script Discover the power of Apps Script for automating tasks. Opens in new tab here.<br>07:09 Great. So now let's put this date somewhere.
This timestamp Understand how to work with timestamps in your sheets. Opens in new tab , where Explore the query where clause for advanced data filtering. Opens in new tab we wanna put it is if it's C1 that's clicked, we want to put it in c3.<br>07:21 So spreadsheet Get familiar with the basics of Google Sheets. Opens in new tab , app dot get active spreadsheet Understand how to reference the active spreadsheet in Apps Script. Opens in new tab dot get sheet by name, sheet one dot get range Learn about ranges and how to manipulate them in Google Sheets. Opens in new tab . You want C, Sorry, what was that again?<br>07:39 C3 set value. It's gonna be time start. Now we can take the exact line here, put it here. But in, let's move my face up here.<br>07:53 Instead of c3, it'll be d3. So now we can even delete these two, right? This duration doesn't show up if this is edited in any way.<br>08:04 C1, there we go. We got a time stamp.
And then if D one is edited in any way, we can move that to false or true anything.<br>08:16 D three is not working. Oh, because we have time to start here. I forgot to edit time. And there we go.<br>08:25 That should work now. So any edit here, and we have a duration. So now anytime we click here, this changes.<br>08:33 Anytime we click here, this changes. So we've churned these check boxes into buttons a couple ways. We can sort Learn how to sort data effectively in Google Sheets. Opens in new tab of make this instead of check boxes, right?<br>08:45 Well we can keep them check boxes, but we can change their format Master formatting techniques to improve your sheet's appearance. Opens in new tab . Let's make this A hundred.
We need two.<br>08:56 Change this. So if we change the size of these to a hundred, and we can also change the text to almost, we can actually turn this into almost imperceptible change.<br>09:17 But now we have this and we have this. And they can be big buttons, right? They can be buttons, the entire cell.<br>09:24 But the cool thing is we don't even need check boxes. We can instead, let's just type in start and you'll see this timestamp Understand how to work with timestamps in your sheets. Opens in new tab .<br>09:34 Let's end that and then we can type in end and times stamp will occur.
But if you do want something like check boxes, which are pretty fun little action items Discover how to create actionable items in your spreadsheets. Opens in new tab , right?<br>09:50 What you could do is say C one when this time starts just to uncheck it. So we would do the same spreadsheet Get familiar with the basics of Google Sheets. Opens in new tab app, C one set value.<br>10:05 And all we have to do, I think is set it to false, see if that works. So if I click true, then this should, C1 should also set it.<br>10:25 Oh, I know, I think we just have to do it without the brackets. So now each time I click this, it will set it back to false.<br>10:38 So the D one, let's fix that.
So this allows it to really be a little bit of a button. So this just needs to be D one.<br>10:47 We can also set it that if it's, if it's already, if it's just setting it to true. So if I actually put an end here, I think this will be a problem.<br>10:59 No, no, no problem. So just un checks it basically. Oh, actually this one doesn't work. So D one oh haven't saved little orange buttons here.<br>11:13 We can clean up our code a little bit. Let's just change this to variable sheet one equals this. And then sheet one.<br>11:27 And we can change this to sheet one.
Shouldn't change anything but just makes our code a little bit easier to read sheet one.<br>11:48 So we'd need variable one equals just line this up a little bit. Change this all sheet one. So again, this doesn't change the code in any way just makes it a little easier to read.<br>12:12 This all can be sort Learn how to sort data effectively in Google Sheets. Opens in new tab of separated like this as well, but do believe, so we're giving an enter, but we're not really changing the script at all.<br>12:26 Maybe. Yeah, so that's all easier to read.
So now, now you should be able to create a timer with app script Discover the power of Apps Script for automating tasks. Opens in new tab anywhere in your sheet.<br>12:43 Have the edit access Learn about edit access and permissions in Google Sheets. Opens in new tab , sort Learn how to sort data effectively in Google Sheets. Opens in new tab of be check boxes or it could be really anything. Edit, access, edit. We can write these if functions Dive deeper into functions and their applications in Sheets. Opens in new tab .<br>12:54 We have an oned, we can also log to see if we're actually correct. Copy paste this sheet if you want, but let's double check that it actually works.<br>13:03 Now we can have our duration here if is blank is not gonna show up until the end. So let's start our timer and let's like, wait 10 seconds, right?<br>13:14 10, 9, 8, 7, 6, 5, 4, 3, 2, 1. Done.
And okay, that was 13 seconds. But there we go. We have a duration, we have a timer. We can use this for Pomodoro.<br>13:30 We can use this to test solving questions and answers Explore how to manage answers and responses in your sheets. Opens in new tab on tests. We've got a lot of options here for Timer.<br>13:39 Hopefully this was helpful for you.</div>
Courses
Sheet Stories / Video Notes + ADDED: Email Notifications
00:00:00
Fast FAQS
Enter Google Drive File Name Get URL
ChatGPT Clone in Google Sheets Part 2
Create an Internal Google Sheets Add-on
Tweet From a Sheet
Why Different Cell References in AI Integration in Sheets?
Show Sheet Tabs Based on Edit
Add Title Case to Google Sheets
How to Power Testimonials with Google Forms and Sheets
Getting Started Coding in Apps Script
Seek Errors When Coding Apps Script
Think Like a Programmer: Develop The Mindset of an Apps Script Coder
ChatGPT Clone in Google Sheets Part 1
Embed a Number in a Website from a Google Sheet
Create Navigation Like A Book or Presentation
Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet
00:29:08
Hold a Giveaway Raffle in a Google Sheet
Quickstart Tutorial OpenAI API in Google Sheets
Capture Emails from Website Form to a Google Sheet (Without Zapier)
Embed a Headline in a Website from Google Sheets
Create a new Spreadsheet from just a Name in a Sheet.
00:05:21
Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet?
00:05:43
Email Yourself a Cell from a Google Sheet, Every Day
OpenSea Data Inside Sheets
Create an Email Campaign Stats Calculator
00:35:13
Twitter App Clone in a Google Sheet
Dylan Asks: How to Automatically Delete Rows If Cell Contains Value
Highlight Row as You Move Your Cell Selection
Create a Timer with Apps Script
LinkTree in a Google Sheet
00:11:22
Password Protecting Data In a Google Sheet
Automatic Weekly Backup of Google Sheets
Create a CPM Custom Function (Create Better Calculators!)
Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script
00:12:29
What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users
Sync Two Tabs Without ImportRange()
Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.
00:00:00
Password Protecting Data In a Google Sheet Part 2 The Basics
Benoit Asks: How to Convert Case
00:07:35
Learn to Code in Google Sheets, For Programmers
Add a Checkbox to Turn on Dark Mode
00:05:10
Write Your First Script
00:08:31
Find Keywords in Any Column. Create quick search dropdown to find keywords
00:09:37
Basic CRM - Add a Powerful Script To Move Row Based on Status
How To Improve: 1,000 Business ideas: Business Idea Generator
00:11:20
Let's Make a Bookmarklet!
00:12:37
Troubleshooting Bitly in a Google Sheet Script
00:07:07
Unique Features - Design a Better Dashboard Part 2
00:04:13
How To Set Up Stripe Webhook to Google Sheets with Google Script
00:22:10
How to Edit a Macro
00:08:22
Sheet Stories / Video Notes + Clear 24 Hour Old Videos
00:35:10
Add A Timestamp to Task Lists (without Now Formula)
00:07:44
Make your Custom Functions Like Native Functions | Custom Function Autocomplete
00:17:58
Create a Changelog Between 2 Cells Custom Function | To learn Double For Loop
00:23:26
New Syntax for WhatChanged Formula in Google Script
00:07:14
How to Record Macros
00:06:20
2 Ways to Delete Lines Quickly (CAREFUL, it's a script!)
00:09:53
Deep Inside Dark Habits Google Script
00:18:54
How to Trigger Macros Daily
00:06:58
5 Ways to Create Coupon Codes | Create UUIDs
Create a Radio Button From Checkboxes Using Google Apps Script
00:15:01