Tag Archives: Google Apps Script

Google Apps Script – custom menu – part 004.

This tutorial is about how to add a custom into your google document using the google app script.
First you need to have one open document and then click into menu : Tools – Script editor …
You will see a new document into your browser with a link like this: https://script.google.com …
This will allow you to create New – Project , Script file , Html file and google documents.
Use the Code.gs like base of script and add this source of code:

Now add this new Html page named Page.html with this source code:

The result is this:

The base of drawing menu is the onOpen function to create and draw the menu by get the document and create and add menu and submenu with separators. This come with the text of muenu and the functions for each click on menu.

In this example, I used one html page file. That html page is show us by using the showDialog function.
The documentation of Google Apps Script tell us:
The UI service in Google Apps Script provides the ability to build a user interface for displaying or capturing information using user interface elements called widgets.
Overview

Your scripts can create a wide range of user interface elements, including, but not limited to, the following:

Push buttons
Radio buttons
Toggle buttons
Check boxes
Text fields
Labels
Titles
List boxes
Dialog boxes
Panels of many types
And far more elements than it’s possible to list here.

You can also test one edit box example by adding this function and change the onOpen function to show it.

Posted in All, Google Apps Script, Programming. Tagged with , , , .

Google Apps Script – google maps – part 003.

The Maps Services service allows scripts to generate static maps, find directions, convert addresses into geocode coordinates, and sample elevations.

This is a simple example about how to make one static map using data from one spreadsheet.

Also you need to follow this tutorial.

I put all comments on script to make simple to read the source code and how it’s working.

google_apps_script_maps

The full source code of this tutorial :

Posted in All, Google Apps Script, Programming. Tagged with , , , .

Google Apps Script – trigger and gmail – part 002.

What is a trigger ? The google come with :

A trigger is a type of script resource that listens for a particular event and executes a function when that event fires.

Let’s make a simple example using triggers.

I will make a script to sent a simple mail every 1 minute.

First will need to see my first tutorial.

Follow the steps to create a new google spreadshet and open a new script.

After that add this source code to your script and change your_mail with your real gmail account:

Go to Resources -> All your triggers …

google apps script trigger

You will see something like this. Set your trigger like in the next image.

google apps script trigger

Save your script and run it. Go to gmail account will see one mail each minute.

You can use the blue notification link is used to send email notification…you can use that.

All emails I got from this script.

google apps script trigger

To stop this trigger just go to Resources -> All your triggers delete the trigger and save your script.

NOTE: Check if you stop the script! Also your email will be full with emails from this script.

Posted in All, Google Apps Script, Programming. Tagged with , , .

Google Apps Script – Creating UI – part 001.

What is the Google Apps Script?

It’s a JavaScript cloud scripting language that extends Google Apps and provides easy ways to automate tasks across Google products and third party services.

So you can deal with all google products like docs , gmail , calendar , maps etc. to make all good for you.

Now it’s three ways users access UI developed in Apps Script :

– google spreadshet

– google sites

– standalone – can be accesed by URL

It’s two types of apps Script UI Objects.

+panels

-form panel

-horizontal panel

-vertical panel

-flow panel

-… and more

+widgets

-text box

-labels

-buttons

-check boxes

-text area

-radio buttons

-… and more

How to using panles in the right way…

First you need to create the application.See the script:

You can also create one horizontal panel

… or maybe if you want an flow panel

Let’s make one simple script example to show you how to do it.

First open one new spreadsheet in your google drive account.

Go to Menu – Tools -> Script Editor , see the next image:

appscript-001

Select Blank Project …

appscript-002

You will have one new tab in your browser , this will be the editor to write your script.

appscript-003

Write now in this editor this script.

Save the script and try to run button (will see something like one play button in the menu).

First time when you try to run project will need some authorization. Be agree.
http://free-tutorials.org/wp-content/uploads/2013/08/google apps script authorization
In the tab browser with your spreadsheet will see this:

appscript-004

The next step is to make one function to handle user action.

The handlers are used to wire user response to Apps Script functions.

This it’s the full source script :

Posted in All, Google Apps Script, Programming. Tagged with , , .