class SpreadsheetApp method .setValues()

SpreadsheetApp is the Apps Script service.

.setValues() is the method name you will see after a dot in your code.

What it does

Writes a 2D array of values into a range of cells.

Why it's used

  • Paste a whole calculated table back in one write.
  • Fill a report block from API results or transformed data.

Common errors

  • Forgetting parentheses on setValues. Write SpreadsheetApp.setValues(), not SpreadsheetApp.setValues or setValues by itself.
  • Skipping dots between chained calls. Each step needs a dot, like SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Data').setValues().
  • Adding spaces where they do not belong. Write SpreadsheetApp.setValues(), not SpreadsheetApp .setValues(), SpreadsheetApp.setValues (), or SpreadsheetApp . setValues().
  • Wrong capitalization. Use SpreadsheetApp and setValues, not spreadsheetapp or setvalues.

Explore

Related methods

  • .getValues()

    Reads values from every cell in a range as a 2D array.

  • .setValue()

    Writes a value into a single cell.

  • .offset()

    Returns a range shifted by a number of rows and columns.

  • .getValue()

    Reads the value stored in a single cell.

  • .getRange()

    Returns a range of cells by A1 notation or row and column numbers.

Better Sheets tutorials

Build a Case Converter From Scratch

Build a Case Converter From Scratch

Create a little web app, or a tool inside of Google Sheets that can take...
Create a Radio Button From Checkboxes Using Google Apps Script

Create a Radio Button From Checkboxes Using Google Apps Script

Let's code a Radio button that turns off all checkboxes except the one c...
Google Maps Scraper for Outreach

Google Maps Scraper for Outreach

Get this fun template to search on google maps via API, and quickly mess...
How To Format Sheets for Notes

How To Format Sheets for Notes

Create sortable notes in Three ways.  1. By adding the original word ove...
How to Power Testimonials with Google Forms and Sheets

How to Power Testimonials with Google Forms and Sheets

I show you how I use a Google Form and a Google Sheet to power the testi...
Twitter App Clone in a Google Sheet

Twitter App Clone in a Google Sheet

I built a twitter clone in Google Sheets

Related blog posts

Written guides about SpreadsheetApp.setValues().

Browse the blog