Last updated stamp
onEdit sets the cell in column F on the same row to new Date() when column D changes to Done.
setValue writes a single value into one cell on a Range object. Pass a string, number, boolean, or Date and Apps Script stores it in the grid. It is the simplest write operation and appears constantly in triggers, menus, and small automations that update one field at a time.
Use setValue for single-cell updates: stamp a timestamp, flip a status flag, write a computed ID into one cell, or clear one field with an empty string.
Skip setValue when updating many cells. Build a 2D array and use setValues once. Repeated setValue calls in large loops are slow and can hit execution limits.
Get a Range with getRange('E5') or offset from a known row.
Call range.setValue(value) with the data you want stored.
JavaScript Date objects usually become proper date values in the cell.
Use setNumberFormat after setValue if display format matters for your team.
In onEdit, avoid writing back to e.range without checking oldValue to prevent loops.
Test on a copy because script writes do not Undo with Ctrl+Z.
onEdit sets the cell in column F on the same row to new Date() when column D changes to Done.
After processing, setValue on Settings!A1 back to READY so the next menu run knows the job finished.
catch block calls getRange('B1').setValue('API failed at ' + new Date()) for a visible status on the Dashboard tab.
Build this without starting from a blank cell
Use a Better Sheets tool for setValue, then watch a walkthrough when you want the full pattern.
Watch how setValue works
Guides that explain setValue in more depth.
Nothing is better than Google Sheets. You just need to learn more about the unlimited power of Google Sheets. Functions, Formulas, Apps Script and more.
Read post →Did you know you can use Google Apps Script to turn a Google Sheet into a free, auto-syncing database for your website? This guide shows you exactly how to set it up. You’ll prepare your spreadsheet, write a few lines of code and publish your site. Don’t worry if you’re not a developer, we’ll walk you through it. Why Use Google Sheets as a Database? For small projects, Google Sheets offers many advantages over traditional databases: * Free hosting and storage * Easy to edit data without...
Read post →Did you know you can actually code in Google Sheets?
Read post →The onEdit trigger runs a script automatically when someone changes a cell in your spreadsheet. It is one of the simplest ways to make Sheets react to user input without clicking a custom menu. You define the function in Apps Script and bind it to the onEdit event for that file.
Read guide →Triggers tell Apps Script when to run a function: on edit, on open, on a schedule, or when a form is submitted. Simple triggers use reserved names like onEdit. Installable triggers are created in the Apps Script Triggers page and can do more, including running as a specific user or on a timer.
Read guide →Loops in Apps Script let you repeat code over rows, columns, sheets, or API pages. You read ranges into arrays with getValues(), process each item in a for or forEach loop, then write results back in one setValues() call when possible. Batch reads and writes beat cell-by-cell updates for speed and quota limits.
Read guide →Automation means work happens without repeating the same clicks every day: imports update, emails send, rows move, and dashboards refresh. In Sheets, automation usually stacks built-in features, Apps Script, and sometimes the Sheets API or add-ons. Start with the lightest tool that still solves the job.
Read guide →Done reading about setValue?
Membership unlocks 636+ tutorials, unlimited generators, and every template. Practical lessons. Zero fluff.
Need this once
Jump to a free tool or a single tutorial for this topic.
Learning Sheets for real
Unlock the full library, generators, and templates with membership.