Do you want a button in Google Sheets that records the current time in one click? You can set that up in a few minutes with a short Apps Script and a simple button attached to it.
How do I add a one click time recording button in Google Sheets?
If you just want the fastest way to get a working button, here is the quick setup that writes the current time into the active cell.
Quick steps to add the time recording button
- Open Extensions → Apps Script.
- Paste the function below and save.
- Insert a Drawing or image, right click it, choose Assign script, and enter
recordTime. - Click the button to insert the current time in the selected cell.
After you set this up once, you can click the same button in any row and it will always fill the selected cell with the current timestamp.
How does the time recording button script work?
The script looks at the cell you have selected and writes the exact date and time into it. You attach the script to a drawing or image so clicking the button runs the function.
Key behaviors of the time recording script
- The script uses
getActiveSheet()andgetActiveCell()to know where to write. - Every click inserts a fresh
new Date()value in the current cell. - Google may ask you to authorize the script the first time you run it.
function recordTime() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var cell = sheet.getActiveCell();
cell.setValue(new Date());
} First time you run it, Google will ask for authorization. Accept the prompts to proceed.
You do not need separate buttons for each cell. Select the cell first, then click the button, and the script will write the timestamp into the place you chose.
How do I set up the time recording button step by step?
If you prefer a detailed walkthrough, follow these steps to build and test the button from scratch.
What you set up for the button
- You create a small script in Apps Script.
- You insert a drawing or image to act as the button inside the sheet.
- You assign the script name
recordTimeto that button.
- In your sheet, go to Extensions → Apps Script.
- Delete any placeholder code, paste the function above, then click Save.
- Go back to the sheet. Insert a Drawing or an Image to use as a button.
- Right click the Drawing/Image, choose Assign script, and enter
recordTime. - Select the target cell and click the button. The current time appears.
If you want to show only the time, format the cell as Format → Number → Time.
Once the script and button are set up, you can reuse the same layout in new sheets, copy the button where you need it, and record time in one click without typing.
Frequently Asked Questions
How do I record only the time and not the date?
The simplest way is to set the cell format to Time via Format → Number → Time. The stored value is a timestamp, but it will display as time only.
Can I always write to a specific column in the current row?
Yes. For example, to write to column B of the current row:
function recordTime() {
var sh = SpreadsheetApp.getActiveSheet();
var r = sh.getActiveCell().getRow();
sh.getRange(r, 2).setValue(new Date());
}Why do I see an authorization prompt?
The first run requires permission for the script to access your spreadsheet. Review and allow when prompted, then try the button again.
Does this work on shared sheets?
Yes. Anyone with edit access can use the button. Each editor may need to authorize the script on first use.