Google app
Script utilities
UrlFetchApp, PropertiesService, and LockService work in any Apps Script project. Use them to call web APIs, save settings between runs, and stop two runs from overlapping.
Choose a task using Script utilitiesStart with an outcome
Tasks that use Script utilities
Choose the result first. Each card opens a step-by-step guide.
- Script utilities 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.
- Script utilities Store settings with PropertiesService
Keep a setting such as an email address out of your code and change it without editing the script. The project stores it as a script property that every run can read.
- Script utilities Check a website and alert when it is down
Get one email when a website stops answering and one when it is back. An hourly trigger fetches the address, and a saved script property stops the script from emailing you every hour during one outage.
Snippets
Snippets for Script utilities
Complete functions you can paste and run one at a time.
- 12 snippets Dates, text, and array snippets
Short functions for dates, currency, text, and arrays. Run one in the Apps Script editor to see its result in the Execution log.
- 12 snippets Triggers and script control snippets
Short functions that install or remove triggers, remember a value between runs, stop two runs from overlapping, and email you when a function fails.
- 10 snippets Web request snippets
Short functions that call a URL with UrlFetchApp. Change the URL and options to match your own API.
Object reference
Objects available in Script utilities
Open an object when you need to get it, try a common action, or inspect exact method signatures.
- Object reference HTTP response
UrlFetchApp.fetch() returns an HTTPResponse after calling a URL. Pass muteHttpExceptions: true so error status codes return an HTTPResponse you can check with getResponseCode() and getContentText().
- Object reference Properties
Properties store text values under names you choose, called keys, and keep them between runs. Use getProperty() and setProperty() to read and save them. PropertiesService.getScriptProperties() is shared across the project, user properties are per-person, and document properties are per-file.
- Object reference Lock
A LockService.Lock keeps two trigger executions from editing the same Sheet, Doc, or property at the same time. Acquire it with tryLock(timeoutInMillis) and release it in a finally block.