Sends an HTTP request to a URL and returns the response.
class UrlFetchApp method .fetch()
UrlFetchApp is the Apps Script service.
.fetch() is the method name you will see after a dot in your code.
What it does
Why it's used
- Call Stripe, Slack, or any REST API from a sheet button.
- Post sheet rows to a webhook when something changes.
Common errors
- Forgetting parentheses on fetch. Write UrlFetchApp.fetch(), not UrlFetchApp.fetch or fetch by itself.
- Skipping dots between chained calls. Each step needs a dot, like UrlFetchApp.fetch().
- Adding spaces where they do not belong. Write UrlFetchApp.fetch(), not UrlFetchApp .fetch(), UrlFetchApp.fetch (), or UrlFetchApp . fetch().
- Wrong capitalization. Use UrlFetchApp and fetch, not urlfetchapp or fetch.
3 Snippets using this methods
Explore
Related methods
-
.fetchAll()
Sends multiple HTTP requests in parallel.
-
.getHeaders()
Returns the HTTP headers from a response.
-
.getResponseCode()
Returns the HTTP status code from a response.
-
.getContentText()
Reads the response body as text.
More Apps Script
3 Better Sheets tutorials
Access Free API's with Google Sheets
Access the Dictionary API to get Definitions for Words in Google Sheets
Automatic Screenshots in Apps Script
Related blog posts
Written guides about UrlFetchApp.fetch().