Writes a value into a single cell.
class SpreadsheetApp method .setValue()
SpreadsheetApp is the Apps Script service.
.setValue() is the method name you will see after a dot in your code.
What it does
Why it's used
- Write a timestamp, status, or result into one cell.
- Stamp last run or an error message in a control cell.
Common errors
- Forgetting parentheses on setValue. Write SpreadsheetApp.setValue(), not SpreadsheetApp.setValue or setValue by itself.
- Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').setValue().
- Adding spaces where they do not belong. Write SpreadsheetApp.setValue(), not SpreadsheetApp .setValue(), SpreadsheetApp.setValue (), or SpreadsheetApp . setValue().
- Wrong capitalization. Use SpreadsheetApp and setValue, not spreadsheetapp or setvalue.
Snippets using this method
- Ultimate Prompt Writer and Prompt Rater
- Visicalc 2023 Design Walkthrough
- Visicalc 2023 Quick Walkthrough
- Tweet From a Sheet
- SubSpyHub Subreddit Scanner
- Simple Inventory Management Automations
- Sync Tabs in Different Sections
- Sync Many Tabs without ImportRange()
- Timestamp When Done (With Code)
- Spreadsheet Automation for Beginners
- Shaman: AI Blog Writer
- Shaman: AI Blog Writer
- Twitter App Clone in a Google Sheet
- Sync Two Tabs Without ImportRange()
- Track Every Edit (Almost)
- Sheet Stories / Video Notes + Clear 24 Hour Old Videos
- Proof of Life
- Saving OpenAI API Calls inside of Google Sheets
- I Created an Automatic Emailer
- Introducing SheetFools
- Make AI-generated Poems Based on Name
- One Million Checkboxes
- Iterate Numbers with a Simple Apps Script
- Onboarding Scheduler
Explore
Related methods
-
.getValue()
Reads the value stored in a single cell.
-
.setValues()
Writes a 2D array of values into a range of cells.
-
.setNote()
Adds or updates the note attached to a cell.
-
.deleteRow()
Deletes a single row from the sheet.
-
.insertSheet()
Adds a new sheet tab to the spreadsheet.
More Apps Script
Better Sheets tutorials
2 New Ways To Add Emoji Reactions
Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet
Add NPS to Your Google Site
Add Tasks to Google Tasks From Google Sheets
Automate Emails
Automate Form Response to Confirmation Email
Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet?
Breaking Through Errors In Apps Script
Build a Book Recommender with AI in Google Sheets
Build a Case Converter From Scratch
Build a License Key Generator and API in 20 Minutes
Build Your Own AI Writer in Google Sheets
Built a Cookie Clicker Clone in Google Sheets
Capture Emails from Website Form to a Google Sheet (Without Zapier)
ChatGPT Clone in Google Sheets Part 1
ChatGPT Clone in Google Sheets Part 2
Convert Google Sheets into a REST API
Create an Automated Task List
Create a new Spreadsheet from just a Name in a Sheet.
Create a PR Agency From Scratch
Create a Radio Button From Checkboxes Using Google Apps Script
Create a Stop Watch in a Google Sheet
Create a Timer with Apps Script
Create a Vote Button from Google Sites to Google Sheets
Create a Waterfall of AI Prompts and Responses
Create New Worksheet When Google Form Submitted
Creating A Dark Mode Theme | Announcing Dark Habits
Curate Google Sheets Easily - Automatic Bookmarklet Maker
Daily Writer's Word Count Tracker
Deep Inside Dark Habits Google Script
Embed Email Form and Name Form into Website to Google Sheets
Enter Google Drive File Name Get URL
Every Locale Listed in Google Sheets and a Tool to Save Your Sanity
Expense Tracker Template with Data Entry Form Inside Sheets
Fast FAQS
Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.
How do I reference a different spreadsheet in Apps Script?
How to Copy To New Tab When Checked
How to Create AI Images From Google Sheets
How to Merge Cells in Google Sheets
How to Turn Background Color to Text
I Created an Automatic Emailer
Introducing SheetFools
Iterate Numbers with a Simple Apps Script
Learn to Code in Google Sheets, For Programmers
LinkTree in a Google Sheet
Make AI-generated Poems Based on Name
Now Do It Every Damn Day - Learn to Code in Google Sheets Part 5
Onboarding Scheduler
One Million Checkboxes
Password Protecting Data In a Google Sheet
Password Protecting Data In a Google Sheet Part 2 The Basics
Saving OpenAI API Calls inside of Google Sheets
Shaman: AI Blog Writer
Simple Inventory Management Automations
SubSpyHub Subreddit Scanner
Sync Tabs in Different Sections
Sync Two Tabs Without ImportRange()
Timestamp When Done (With Code)
Track Every Edit (Almost)
Tweet From a Sheet
Ultimate Prompt Writer and Prompt Rater
Visicalc 2023 Design Walkthrough
Related blog posts
Written guides about SpreadsheetApp.setValue().
How to reference a different Google Spreadsheet in Apps Script?
Transferring Data Between Cells in Different Spreadsheets
Read post →What's Better Than Google Sheets?
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 →Explore Coding in Google Sheets
Did you know you can actually code in Google Sheets?
Read post →