Builds a text response for a web app request.
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
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.
Snippets using this method
- Quickly Build a Daily Random Motivational Quote Website
- I Created an Automatic Emailer
- How to Power Testimonials with Google Forms and Sheets
- How to Trigger Macros Daily
- Embed Email Form and Name Form into Website to Google Sheets
- Embed Quote and Author to Daily Quote Website
- Embed a Number in a Website from a Google Sheet
- Embed a Headline in a Website from Google Sheets
- Create a Tracking Number Fetcher with Google Sheets and Google Sites
- Create a Vote Button from Google Sites to Google Sheets
- Convert Google Sheets into a REST API
- Capture Emails from Website Form to a Google Sheet (Without Zapier)
- Better Email Form on Google Sites
- Build Your Own Net Promoter Score (NPS) Survey on a Web Site
- Build a Book Recommender with AI in Google Sheets
- Build a License Key Generator and API in 20 Minutes
- Build a Job Status Checker API in 15 Minutes
- Automate Form Response to Confirmation Email
- Add NPS to Your Google Site
Explore
Related methods
-
.setMimeType()
Sets the content type of a web app response, like JSON or XML.
More Apps Script
Better Sheets tutorials