class ContentService method .createTextOutput()

ContentService is the Apps Script service.

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

What it does

Builds a text response for a web app request.

Why it's used

  • Return plain text or JSON from a web app doGet.
  • Send a simple API response from Apps Script.

Common errors

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

Explore

Related methods

  • .setMimeType()

    Sets the content type of a web app response, like JSON or XML.

2 Better Sheets tutorials

Add NPS to Your Google Site

Add NPS to Your Google Site

Create buttons on your Google Site to get an NPS, or Net Promoter Score ...
Automate Form Response to Confirmation Email

Automate Form Response to Confirmation Email

Create an email automatically when someone fills out a google form. incl...