Google app
Google Sheets
SpreadsheetApp lets a Google Sheets script read a Sheet or Range, add a custom menu or formula, and act on each row, such as sending one email per row.
Choose a task using Google SheetsStart with an outcome
Tasks that use Google Sheets
Choose the result first. Each card opens a step-by-step guide.
- Google Sheets Send an email for each row in a Google Sheet
Send one email to each person listed on a Customers tab. The script marks each row Sent as it goes, so a later run sends only to rows that are not marked yet.
- Google Sheets Send an email when a status changes
Email the person on a row whenever the status in that row changes. One installed trigger covers every tab in the spreadsheet, including tabs you copy later.
- Google Sheets Create a Google Doc from each Sheet row
Create one short Google Doc for each row on a Projects tab that has no document link yet. The script writes the link to the new Doc back into the row.
- Google Sheets Add a custom menu to a Google Sheet
Add a menu named Helpful tools to the menu bar of a Google Sheet. Its one item shows which cell is selected. Save the script, reload the Sheet, and the menu appears.
- Google Sheets Add a timestamp when a row changes
When you change a status cell, the script writes the current date and time into the same row. You save the script and nothing else needs to be installed.
- Google Sheets Copy a row when a checkbox is checked
Check a box on a Students tab and the script adds that person to a Tracking tab. It then writes Tracked in the Students row, so checking the box again does not add a duplicate.
- Google Sheets Write a custom function in Google Sheets
Write your own formula for Google Sheets. This one converts Celsius to Fahrenheit, works on one cell or a whole range, and shows a clear message when a cell holds text instead of a number.
- Google Sheets Copy unique rows to a clean tab
Remove duplicate people from a contact list. The script keeps the first row for each email address and writes those rows to a tab named Clean, leaving the original list as it is.
- Google Sheets Move finished rows to an Archive tab
Move every row marked Done from a Tasks tab to the bottom of an Archive tab. The script deletes rows from Tasks, so test it on a copy of the file first.
- Google Sheets Fill a Google Doc template from a Sheet row
Make one filled-in copy of a template Doc for each row on a Letters tab. The script swaps {{Name}}, {{Date}}, and {{Amount}} for the values in the row and writes the link to the copy in column D.
- Google Sheets Log new emails to a Google Sheet
Keep a list of recent emails in a spreadsheet, one row per message with the date, From address, subject, and a link. A message ID column keeps a second run from adding the same message twice.
- Google Sheets Import data from a web API into Sheets
Pull a seven-day weather forecast from the free Open-Meteo API into a practice spreadsheet. The script checks the response and writes only cells A1:C12 of the Forecast tab, with the source and license links below the data.
- Google Sheets Create Calendar events from Sheet rows
Turn rows on an Events tab into events on your Google Calendar. The script creates an event for each row that has no event ID yet, then writes the new ID back into the row so a later run skips it.
- Google Sheets Email yourself a weekly sheet summary
Get a short email every Friday with the numbers from an Orders tab: how many rows it has, the total of column C, and how many rows are not Done. Run the setup function once to install the weekly trigger.
- Google Sheets Back up a spreadsheet to Drive every week
Keep a dated copy of a spreadsheet in a Drive folder. Run the setup function once, and every Monday morning the script saves a new copy with the date in its name.
Snippets
Snippets for Google Sheets
Complete functions you can paste and run one at a time.
Object reference
Objects available in Google Sheets
Open an object when you need to get it, try a common action, or inspect exact method signatures.
- Object reference Spreadsheet
A Spreadsheet is the whole Google Sheets file. Use SpreadsheetApp.getActiveSpreadsheet() or openById() to get it, then call getSheetByName() or getActiveSheet().
- Object reference Sheet
A Sheet is one tab inside a Google spreadsheet. Get it with getSheetByName() or getActiveSheet(). Use getLastRow() to find the last row with content, or getRange() to select cells to read.
- Object reference Range
A Range represents one cell such as A2 or a rectangular block of rows and columns in a Sheet. Use getValue() for one cell and getValues() or setValues() for a 2D array of rows.