How to Insert Timestamp in Google Sheets

Google Sheets is a great tool when you're collaborating and working with people on the same sheet. It allows people to work in the sheet simultaneously.

In this tutorial, you'll learn various to insert timestamp in Google Sheets:

  • Using Keyboard Shortcuts.
  • Using Google Sheet Functions.
  • Using Script.

Insert Timestamp Using Keyboard Shortcuts

If you're looking to manually insert timestamps in some places in the worksheet, using the keyboard shortcut is the way to go.

Here are the keyboard shortcuts:

  • To insert current date: Control + : (hold the Control key and press the colon key).
  • To insert current time: Control + Shift + : (hold the Control and Shift keys and press the colon key).

Insert Date and Time Using Functions

Google Sheet Functions can be used to insert the current date or time.

To insert the current date in Google Sheets, enter the following formula in a cell:

=TODAY()

This function does not take any input arguments.

If you want to insert the current date as well as the time, use the below function:

=NOW()

There are couple of important things you need to know about these functions:

  • Both TODAY and NOW functions are volatile. This means that the formula gets recalculated whenever there is a change in the Google Sheet. For example, if you enter a value in a cell or close the sheet and open it again, it will recalculate and show you the date/time at the time of recalculation.
  • The result of both TODAY and NOW functions are numbers. This means that you can change the format the display the date and time differently if needed.

Automatically Insert Date and Time Using Script

The drawback of using functions is that it recalculates and changes the date/time value every time there is a change. If you are tracking activities, you may not want it to change once it is entered.

This can be done using a simple script in Google Sheets.

Here are the steps:

  • Go to Tools –> Script Editor.insert-timestamp-in-google-sheets-script-editor
  • In the script editor code window, copy paste the following code (credit: Stackoverflow):
    function onEdit() {
    
    var s = SpreadsheetApp.getActiveSheet();
    
    if( s.getName() == "Sheet1" ) { //checks that we're on the correct sheet
    
    var r = s.getActiveCell();
    
    if( r.getColumn() == 1 ) { //checks the column
    
    var nextCell = r.offset(0, 1);
    
    if( nextCell.getValue() === '' ) //is empty?
    
    nextCell.setValue(new Date());
    
    }
    
    }
    
    }

insert-timestamp-in-google-sheets-code

  • Save the code.

Now when you enter anything in cells in column A, a timestamp would automatically appear in the adjacent cell in column B.

You May Also Like the Following Tutorials:

>