Categories
Javascript

Extend Google Apps With Custom Scripts

Let’s get to the point straight way – we can extend the functionality of Google apps with our own scripts. Google allows us to create small scripts written in JS and attach these scripts to certain events (aka triggers) of the respective applications. When these events occur, the scripts are executed. For example, we can attach a script to the event when the user loads a document, or edits a spreadsheet or submits a form. The custom code we write allows the opportunity to do some extra processing. Thus it allows us to achieve a lot more than the default functionality. What are the common use cases?

— Adding our custom functions to spreadsheets
— Adding our own Menus to the user interface
— Creating Macros
— Do more with Forms: send customized messages
— Get sophisticated Gmail statistics
— Send out customized email messages to many people on the fly

and a lot more…

Google Developers Zone has it covered pretty nicely in the “Google Apps Script” section. Have a look yourself!

Just as a demonstration of what could be done, here’s a custom script I wrote to try it out. This script is for a form. It is attached to the “Form Submit” event of the form. When the form is submitted, my custom function gets an event. The event object has a “FormResponse” object which we can use to collect the field names and the values. Then we use “MailApp” object to send the submitted data to an email address:

We could do a lot more than that by adding a flick of our own imagination. Cool, no?