How To Add Timestamp When Cell Is Updated in Google Sheets

Last Updated on January 31, 2023 by Jake Sheridan

In this tutorial, you will learn how to add a timestamp when a cell is updated in Google Sheets

How To Add Timestamp When Cell Is Updated in Google Sheets

Google Sheets is a great tool for tracking data, but sometimes you may want to add a timestamp to a cell when it is updated. For example, you may want to keep track of when a certain cell was last modified.

If you are looking for a way to do this, you can use a custom Google Apps Script code to add a timestamp to a cell whenever it is updated.

This guide will show you how to set up Apps Script on your spreadsheet to add a timestamp when a cell is updated in Google Sheets.

How To Update a Timestamp Field When A Cell Is Updated in Google Sheets

Here’s how to update a timestamp field when a cell is updated in Google Sheets.

Step 1

In the Extensions menu, click on the Apps Script option.

Step 2

A new Untitled project will appear in a new tab.

Select the Code.gs file and write the following code into the provided code editor:

function onEdit(e) {

var row = e.range.getRow();

var col = e.range.getColumn();

if(col == 6){

e.source.getActiveSheet().getRange(row,7).setValue(new Date());

}

}

The code above writes a timestamp in column G (seventh column) when the user edits any cell in column F (sixth row). Feel free to replace these numbers to make the code itself fit your particular use case.

Step 3

Save the project by clicking on the Save icon.

Step 4

Now, every time an edit is made in the target range, a corresponding timestamp is added to the sheet.

Summary

This guide should be everything you need to add a timestamp when a cell is updated in Google Sheets.

You may make a copy of this example spreadsheet to test it out on your own.