Reader small image

You're reading from  Google Apps Script for Beginners

Product typeBook
Published inFeb 2014
Reading LevelIntermediate
Publisher
ISBN-139781783552177
Edition1st Edition
Languages
Right arrow
Author (1)
Serge Gabet
Serge Gabet
author image
Serge Gabet

Serge Gabet has been a professional audio equipment manufacturer for 20 years and is now working for an artistic upper school in Brussels, Belgium as a teacher and Technical Manager. He is also in charge of the Google Apps administration of this school. He develops custom applications using Google Apps Script mainly for his school, though he also works in other areas. He has been designated a Top Contributor by Google since June 2011. He was active on the Google Group Help forum till 2012, then on the Stack Overflow forum (the Google Help Group forum was closed in June 2012), and became a first ranker and an all-time contributor on the Stack Overflow forum a few months back.
Read more about Serge Gabet

Right arrow

Chapter 7. Using User Interfaces in Spreadsheets and Documents

There are many situations where we need to present some data from within a spreadsheet or a document but where the standard user interface is not really appropriate. For example, you have a logging sheet of all the visitors of an exhibition and you'd like to show an average count of the people that were present at this exhibition on a given day. It is of course possible to calculate this in a spreadsheet and decide which cell shows this value, but suppose you want to be able to get some variant of this and get a mean value for the exhibition duration; what are you going to do? Create a new cell with another result, and again come up against the need to add a description cell somewhere for identification purposes.

Let's check out an easier solution for this using what we just learned in the previous chapter.

Pop ups


Pop ups are a simple user interface that you could call from a menu or a drawing / image, that presents your result in the form of a couple of listboxes from which you can select the result you want.

Here is a screenshot of such a UI that I created to calculate the working hours of our teachers across three grades and different courses, with horizontal and vertical totals.

The preceding UI panel comes up as a pop-up window and reads data from the current spreadsheet. I don't need to change the data in any way, nor change the layout of my sheet; everything is done from the UI, and I can call it whenever I need it. This is really comfortable to use, but it uses a lot of external resources, such as teacher calendars and custom resources, so it does not become a valid candidate as a demo script.

Let us take a simpler example to show how we can create and use this UI.

The spreadsheet we use here is the main interface of a complete online reservation tool for any public show. After we have...

Summary


We can see that there are many use cases where a simple UI can at least simplify our work with spreadsheets and documents, either by showing data in a way that is not directly available or by adding extra functionalities.

We can also use the UiApp service or HTML service to create UIs; the latter allows us to create more fancy user interfaces if we are using third-party libraries.

Of course, this means that we'll need to learn a lot of new techniques. The complete documentation about jQuery is about 300 pages long (http://forum.jquery.com/topic/jquery-1-7-reference-documentation-as-a-pdf), and I'm not even sure that reading it entirely would be sufficient to use it easily. However, as we shall see in the next chapter, the learning process can be gradual.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Google Apps Script for Beginners
Published in: Feb 2014Publisher: ISBN-13: 9781783552177
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Serge Gabet

Serge Gabet has been a professional audio equipment manufacturer for 20 years and is now working for an artistic upper school in Brussels, Belgium as a teacher and Technical Manager. He is also in charge of the Google Apps administration of this school. He develops custom applications using Google Apps Script mainly for his school, though he also works in other areas. He has been designated a Top Contributor by Google since June 2011. He was active on the Google Group Help forum till 2012, then on the Stack Overflow forum (the Google Help Group forum was closed in June 2012), and became a first ranker and an all-time contributor on the Stack Overflow forum a few months back.
Read more about Serge Gabet