Google Sheets: Add a date when the row was last updated

You have a Google Sheet, you’d like a (or all) row(s) to have a date-stamp added whenever an edit is made. That way others you’re collaborating with will know when the row, or the sheet itself, was last updated at a glance.

If you search for this, you’ll find something like this but it needs some tweaks. This is the third time I’ve searched for it, found it, and then had to re-learn what needed tweaking for it to work for me. So I’m saving it here for my posterity and note-keeping.

Date-stamp whenever a row is modified (🔗)

function onEdit(e) {
    var sh = e.source.getActiveSheet();
    if (sh.getName() !== 'Sheet1' || e.range.getRow() == 1) return; // Skip if we're on another sheet, or not the header row
    sh.getRange(e.range.rowStart, 3).setValue(new Date()) // Put the date in  column 3

See it in action

About Chris

Python developer, Agile practitioner trying desperately not to be a pointy haired boss.
This entry was posted in Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s