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.
10 Snippets using this methods
- Automatically Copy Spreadsheet Tab to New File with Values Only, No Formulas
- Automate Form Response to Confirmation Email
- Automate Help Desk Ticket Closing
- Automatic Calculations
- Add Tasks to Google Tasks From Google Sheets
- Add NPS to Your Google Site
- Add A Timestamp to Task Lists (without Now Formula)
- Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet
- 2 New Ways To Add Emoji Reactions
- 2 New Ways To Add Emoji Reactions
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
10 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
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 →