Book Image

Learning Google Apps Script

By : Ramalingam Ganapathy
Book Image

Learning Google Apps Script

By: Ramalingam Ganapathy

Overview of this book

Google Apps Script is a cloud-based scripting language based on JavaScript to customize and automate Google applications. Apps Script makes it easy to create and publish add-ons in an online store for Google Sheets, Docs, and Forms. It serves as one single platform to build, code, and ultimately share your App on the Web store. This book begins by covering the basics of the Google application platform and goes on to empower you to automate most of the Google applications. You will learn the concepts of creating a menu, sending mails, building interactive web pages, and implementing all these techniques to develop an interactive Web page as a form to submit sheets You will be guided through all these tasks with plenty of screenshots and code snippets that will ensure your success in customizing and automating various Google applications This guide is an invaluable tutorial for beginners who intend to develop the skills to automate and customize Google applications
Table of Contents (16 chapters)
Learning Google Apps Script
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Publishing the script as a web application


You can create awesome web pages/applications by publishing your script as a web application. In this section, you'll see how to publish a script. Start by creating a new Sheet and entering the following code in the script editor:

function doGet(){
  var str = "Hello world!";
  return ContentService.createTextOutput(str);
}

The doGet function will be executed whenever a HTTP/HTTPS request is sent to the script. In the preceding code, ContentService is used to return a string to the browser. Content service can be used to return any type of content including simple text, HTML, XML, JSON, CSV, and so on.

To publish the script, within the script editor, navigate to Publish | Deploy as web app…. A new Deploy as web app dialog will open as shown here:

Select any one of the existing project versions or select New to create a new project version. There will be two choices under the Execute the app as option, Me and User, accessing the web app. For this application...