To add an automatic, permanent timestamp in Google Sheets, use a small Apps Script that writes the current date and time when someone fills in a chosen cell. For a quick manual entry, use a keyboard shortcut; a formula can also create timestamps, but it needs iterative calculation and is easier to disrupt.
What an automatic timestamp means
A timestamp is a date-and-time value recorded alongside an event, such as a new order, a status change, or a completed task. The important distinction is whether the timestamp should stay fixed or keep updating. A permanent timestamp records when the edit happened. A live formula such as NOW(), by contrast, recalculates and can show a later time rather than the original event time.
For example, imagine column A contains a task and column B records when the task was first entered. If a user types “Send invoice” in A2 on November 3 at 9:15 a.m., a fixed timestamp stores that moment in B2. If the task text changes later, a “first entered” timestamp should usually remain the same. A different workflow might deliberately record the latest edit time instead.
Google Sheets does not have a built-in cell setting that automatically stamps a neighboring cell on every edit. You can add that behavior with Google Apps Script, use a circular formula, or insert a date or time manually.
Choose a method for your workflow
Use Apps Script when timestamps must be permanent and created automatically after a user edit. Use a formula when you want a no-code solution and are comfortable enabling iterative calculation. Use a shortcut when a person can enter the timestamp themselves. These methods behave differently, so decide whether the timestamp means first entry, most recent edit, or a manually recorded moment before setting up the sheet.
- Apps Script: Best for a fixed timestamp added automatically in response to edits. It requires a small script and some setup.
- Formula: Avoids scripting, but relies on a circular reference and iterative calculation. It is less suitable for a large shared workflow.
- Keyboard shortcut: Fast and simple, but the user must remember to enter the value. It does not react automatically to another cell changing.
Set up a fixed timestamp with Apps Script
This example watches column A and writes the first timestamp in column B. Row 1 is treated as a header, and an existing timestamp is left alone. The script also handles a user pasting several values into column A at once.
- Open the spreadsheet in a browser and choose Extensions > Apps Script.
- In the script editor, replace any starter code with the code below.
- Save the project, return to the sheet, and enter a value in A2 or a lower cell. The script should put a date-time value in the matching cell in column B.
function onEdit(e) {
const range = e.range;
const sheet = range.getSheet();
// Watch only edits confined to column A, below the header.
if (range.getColumn() !== 1 || range.getNumColumns() !== 1) return;
const firstRow = Math.max(2, range.getRow());
const lastRow = range.getLastRow();
if (firstRow > lastRow) return;
const rowCount = lastRow - firstRow + 1;
const inputs = sheet.getRange(firstRow, 1, rowCount, 1).getValues();
const timestamps = sheet.getRange(firstRow, 2, rowCount, 1).getValues();
const now = new Date();
for (let i = 0; i < rowCount; i++) {
if (inputs[i][0] !== "" && timestamps[i][0] === "") {
sheet.getRange(firstRow + i, 2).setValue(now);
}
}
}
The function is named onEdit, so Google Sheets runs it as a simple edit trigger when a person changes a cell in the spreadsheet. Do not press Run in the script editor to test it: a manually run function has no edit event, so the e parameter is not supplied. Test by editing the sheet itself.
This example is intentionally limited to edits in column A. To watch a different input column, change the column number in the check and change the input range accordingly. To put timestamps in another destination column, update the second column number used in the getRange calls. If the spreadsheet has several tabs, add a sheet-name check before writing, so edits on unrelated tabs do not create timestamps.
Format and preserve the timestamp
The script writes a date-time value, not text. Set how it appears by selecting the timestamp cells and choosing Format > Number > Custom date and time. A format such as year-month-day followed by hours and minutes makes entries easy to sort and read; include seconds if edits may happen close together. Formatting changes the display, not the stored timestamp.
Google Sheets uses the spreadsheet’s time-zone setting when displaying date and time values. Check it under File > Settings if timestamps appear shifted from the time expected. A time zone is especially important when collaborators work in different regions: a stored date-time may display differently according to the spreadsheet’s configured zone. Avoid converting the values to text unless there is a specific reason, because real date-time values are more useful for sorting, filtering, and calculating elapsed time.
The example preserves a timestamp after the input cell is edited again, and it does not clear the timestamp if the input is deleted. If you want a timestamp for the latest edit rather than the first one, remove the check that the destination cell is blank so each qualifying edit writes a fresh time. That change means the original entry time is lost.
Use a formula without Apps Script
A formula can retain the first time a neighboring cell becomes nonblank, but it refers to its own cell. That circular reference requires iterative calculation. With the input in A2 and the timestamp formula in B2, use:
=IF(A2<>"",IF(B2="",NOW(),B2),"")
Enter the formula in B2, then choose File > Settings > Calculation and enable iterative calculation. The exact available calculation controls can vary as Google updates its settings interface, so check the Calculation section if the option is not immediately visible. Copy the formula down for additional rows, adjusting the row references as needed.
This is a compromise, not a truly event-driven timestamp. NOW() is volatile: it updates when the spreadsheet recalculates. Iterative calculation lets the formula retain a prior value, but circular formulas can be confusing to maintain, and clearing A2 makes the displayed result blank. If a permanent audit trail matters, use Apps Script instead. Do not use a plain formula such as =NOW() as a historical timestamp; it displays the current recalculated time, not reliably the time an earlier edit occurred.
Enter a timestamp with a keyboard shortcut
For a one-off manual entry, select a cell and use the Google Sheets shortcut for the current date or time. On Windows, press Ctrl+; to insert the date and Ctrl+Shift+; to insert the time. On Mac, the corresponding shortcuts use ⌘ in place of Ctrl: ⌘+; for the date and ⌘+Shift+; for the time. Shortcuts can vary with keyboard layout or browser settings; Google Sheets’ Help > Keyboard shortcuts menu lists shortcuts available in the current environment.
These insert fixed values rather than a live NOW() formula, but the user must enter them in the correct row. If you need both date and time, insert both in the same cell with a separator, or use an appropriate date-time format and verify the result. Shortcuts are useful for notes and occasional logging, but they are not a dependable substitute for automation when multiple people need consistent timestamps.
Common problems and limitations
- No timestamp appears: Confirm the script is saved, that you edited column A below row 1, and that the destination cell in column B is blank. Editing a different column will not trigger this example.
- The time is wrong or hard to read: Check the spreadsheet time zone and the number format. A time-only display can hide the date, while a date-only display can hide the time.
- Pasting data behaves unexpectedly: The sample supports a multi-row paste confined to column A, but intentionally ignores a paste spanning multiple columns. This prevents unrelated edits from stamping rows.
- A formula change does not trigger it: The simple onEdit trigger responds to user edits, not every recalculation or a value changed by another script or an API. For form submissions or other automated data sources, an installable trigger or a workflow designed for that source may be needed.
- The script does not update after clearing and re-entering: The sample preserves an existing timestamp by design. Clear the timestamp in column B as well if you want the next entry to receive a new first-entry time.
A simple edit trigger is convenient, but it is not an audit log: users with permission to edit the sheet may also change or remove timestamp cells. Protect the timestamp column if accidental changes are a concern, and keep in mind that protection settings affect collaborators’ ability to edit the sheet. For regulated or high-stakes recordkeeping, a spreadsheet timestamp alone may not provide the controls or history required.
When to use another approach
Choose the method based on what event should be recorded. A user-maintained checklist may only need a shortcut. A team intake sheet that stamps a row when a request is entered is a good fit for the script above. A workflow that must record every edit, identify who made it, or respond to submissions from a form needs more than a simple timestamp cell; consider an installable Apps Script trigger and design it for the specific event, permissions, and retention needs.
Google Sheets version history can help review changes to a file, but it is not the same as a purpose-built timestamp column for each row. Likewise, Excel has its own scripting and automation options, but the Google Sheets Apps Script steps and menus here do not apply to Excel. If the sheet is routinely exported to Excel, check that date-time values still display as intended after the export.
Frequently Asked Questions
Can Google Sheets automatically timestamp a row when I enter data?
Yes. A Google Apps Script edit trigger can write a fixed date-time value into a neighboring cell when a user fills in a chosen input cell. The example above watches column A and stamps column B.
Does NOW() create a permanent timestamp?
No. NOW() is a recalculating function, so its result can change. A circular formula with iterative calculation can preserve a value in some workflows, but Apps Script is generally clearer when the timestamp must represent a specific edit.
Can the timestamp update every time the row changes?
Yes. Change the script so it writes the current time on each qualifying edit rather than only when the timestamp cell is blank. That records the latest edit, not the original creation time.
Will the script work when someone pastes several rows?
The provided script handles a multi-row paste limited to column A and stamps each nonblank row whose column B cell is empty. It ignores edits that span multiple columns, and it does not run for changes made by formulas or other scripts.
Can I add a timestamp without code?
Yes. Use the date and time keyboard shortcuts to enter fixed values manually, or use the formula method with iterative calculation. The shortcuts require a person to act, while the formula method has circular-reference limitations.
Why does my timestamp show a different time zone?
Check the time zone in File > Settings and the cell’s date-time format. The spreadsheet’s configured zone affects how date-time values are displayed; collaborators may therefore see a different local time context.
Related
- Excel Time Format: Show Hours and Minutes Only Correctly
- Excel Time Difference in Seconds: How to Calculate
- Excel Date Without Year: Display a Date Without Its Year
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Create a Table in Excel With the Keyboard ShortcutTo create a table quickly in Excel for Microsoft 365 on Windows, click a cell inside your data…
- How to Create a Word Template with Fillable FieldsTo create a fillable Word template, add content controls from the Developer tab, set their properties, then save…
- How to Get Rid of a Hanging Indent in Microsoft WordTo remove a hanging indent in Microsoft Word, select the affected paragraph or paragraphs, open the Paragraph dialog,…
- Signature Line in Word Without the X Placeholder SymbolTo add a signature line in Word without the “X,” make a blank paragraph and apply a bottom…
- Making a Template in Word: Steps, Styles, and SetupTo make a template in Microsoft Word for Microsoft 365 on Windows, create or open a document with…
- How to Open Mail Merge in Microsoft WordTo open Mail Merge in Microsoft Word for Microsoft 365 on Windows, select the Mailings tab, then choose…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.