How to create GUI Form Application in Google Apps Scripting

Create GUI Application Form in Google Apps Scripting – Hello friends, In the previous tutorial I have talked about Sending email on submission of new user registration form. And in that tutorial I have used a form with text box and submit buttons. In this post I will show you how to create GUI form in Google Apps Scripting. For demo purpose, I am going to create Labels, Textboxes and Button. Other GUI components such as check-box, dropdown etc will be covered in future tutorials.

GUI Application Form in Google Scripting

There are certain functions that are used to create GUI application just like in Java AWT or Swings. To create Textbox in Google script, following code is used:

var v = p_app.createTextBox().setName(‘string’).setId(‘ID’);

in the above code ‘v‘ is the variable name used to create text box. p_app is another variable used which holds the entire application and used to call GUI functions. Method used to create GUI is createTextBox() and setName and setId are the identifiers used to fetch value in the code later.

Code to create Label:

var v1=p_app.createLabel(“String of Label”).setId(‘ID’);

Code to create Button:

var btn=p_app.createButton(“Button Label String”).setId(‘Id’);

Complete Code to Create GUI Application Form

create GUI Form Application in Google Apps Scripting

That’s it, deploy the code as Web app and test it. You will see the following output

Google script GUI Form

Just try it and if you face any problem, comment below:

2 Comments

  1. Ankit June 5, 2014
    • Achin Jain June 5, 2014

Leave a Reply