Apps Script Reference  (Create: Create new Spreadsheet | Create new Apps Script

Thursday, September 21, 2023

A simple application using


I will introduce a simple application that uses Google Apps Script and to display a message with the user's name. 

The application places a text box and a button on the screen. 
When the button is clicked, the name entered in the text box is passed to a server-side Apps Script function, which returns a message with the user's name. 
The message is then displayed on the screen.

I will also explain how to use the API to call server-side Apps Script functions from client-side JavaScript. 
The API allows you to pass arguments to the server-side functions and to receive results back from them.


A text box and a button on the screen

Enter your name and click the button, a message will be displayed on the screen.

Source Code
function doGet() {
return HtmlService.createHtmlOutputFromFile('index').setTitle("Title");

function returnHello(name) {
return "Hello" + " " + name;

<!DOCTYPE html>
<input type="text" id="name">
<button id="bt">submit</button>
document.getElementById("bt").onclick = runHello;

function runHello() {
var name = document.getElementById("name").value;
.withUserObject("how are you?")

function onSuccess(result, userObject) {
alert(result + " " + userObject);

function onFailure(e) {
alert([e.message, e.stack]);

call server-side Apps Script functions(in

a callback function to run if the server-side function throws an exception

a callback function to run if the server-side function returns successfully

a second parameter to the success and failure handlers
run a function in


Class (Client-side API)

Latest post

Extracting data from Google Sheets with regular expressions

Introduction Regular expressions are a powerful tool that can be used to extract data from text.  In Google Sheets, regular expressions ca...