class UrlFetchApp method .getContentText()

UrlFetchApp is the Apps Script service.

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

What it does

Reads the response body as text.

Why it's used

  • Read JSON or plain text from an API response.
  • Parse the body after fetch returns.

Common errors

  • Forgetting parentheses on getContentText. Write UrlFetchApp.getContentText(), not UrlFetchApp.getContentText or getContentText by itself.
  • Skipping dots between chained calls. Each step needs a dot, like UrlFetchApp.getContentText().
  • Adding spaces where they do not belong. Write UrlFetchApp.getContentText(), not UrlFetchApp .getContentText(), UrlFetchApp.getContentText (), or UrlFetchApp . getContentText().
  • Wrong capitalization. Use UrlFetchApp and getContentText, not urlfetchapp or getcontenttext.

Explore

Related methods

Better Sheets tutorials

Access Free API's with Google Sheets

Access Free API's with Google Sheets

Get Kanye Quotes, Hogwarts Houses, Public Holidays, and more fun with AP...
Automatic Screenshots in Apps Script

Automatic Screenshots in Apps Script

Related blog posts

Written guides about UrlFetchApp.getContentText().

Browse the blog