Skip to main content

Google Apps Spreadsheet Reporting Scripts

Google Apps Spreadsheet Reporting Scripts


In an effort to create an integrated cloud and open source Business Operating System (BOS), we have been doing a lot of work with Google Apps Spreadsheets and Google Apps Script for dynamic end user reports with data from our internal MySQL databases.
Since GAS provides JDBC access to databases, this seamed pretty easy. But the devil is in the details. We have had JDBC connected Gapps spreadsheets running as our primary reporting tool for operations and sales for over 6 months now, with mixed results.
Have been developing a set of scripts to make connecting Google Apps to MySQL databases easier, they can be found here, with an explaination at the end of this post.


The good
There is a lot of the good... The ability to very rapidly give detailed access to data-based reports to both internal and external users has been a god send. 
The ability to simply "invite" external users has allowed us to fairly elegantly grant access to our customers to relevant reports.
Internally, the ability to create "generic" reports which business users can then use the built-in (fairly basic) pivot ability.
With some base scripts, it is possible to create a whole new report, tailored to business needs within minutes.
Built in versioning helps with detecting end-user errors. With the wide variety of widgets available in GAS UI scripts, it is easy to embed end user help, which is quite nice.


The bad
But there are some problems. Gapps can sometime be very slow without any apparent reason. Mysterious "server errors" pop up every now and again. While a simple ctrl+f5 almost always resolves these problems, it can be frustrating to end users. 


Spreadsheets with thousands of rows can sometimes be quite slow, and frustrating to end users. What is strange about this is that the slowdown seems to be quite random, with really no ryhme or reason. 


Also, GAS seems to still be quite buggy, nothing huge, but quite a few small things. For example the JDBC getters do not seems to work correctly with quite a few data types, so they need to be extracted as text. The documentation can be a bit spotty for GAS as well, but having used OpenSource tools for the past years, am pretty used to that.:) 


One big bummer is the inability to create a "library"of scripts which can be included in other scripts or spreadsheets, but I assume this is a security issue with Google, so I am not holding my breath. We have experimented using Javascript eval and http getting to pull scripts from bitbucket,with fairly unpredictable results, and have given up on that.


The ugly
These things could be deal breakers for some, but we are able to work around them.

  • There is no way to dissallow viewing of script contents to users. Why is this a big deal?
  • Since we are using JDBC, we need to put dbaccess information in the script iteself, including username and password. Since we an not dissallow users from viewing scripts, we are exposing authentication information to all of our users, which is not great.
This is a big deal for us, and are looking for ways around this:
Some ideas come to mind.. I. 
  • Put end user usernames into mysql, then using their google usernames and passwords?
  • Have the database username and pasword information be entered by the end user using a GAS UI script. This could be annoying to end users, and we would have to create and manage a lot of passwords on the MySQL server.

The Code
The code we have been using has evolved over the past months, and will continue to in the coming months.
Currently the system is pretty simple, we send call any stored procedure on the Mysql database (the SP takes card of getting whatever data we want, so we have a bit of a tiered architecture). The stored procedure can have zero or more parameters which are sent by the GAS script. The script dynamically builds the procedure call, so any number of parameters can be used.
Once the SP is called, the script then takes care of:
  • Creating column headers based upon the column names in the result set.
  • Retrieves the values using the correct data type by using the record set meta-data.
  • Put simply the resulting rows into the sheet of choice in the spreadsheet.
Limitations:
  • The data refresh is an truncate-add, all of the existing rows in the sheet refreshed will be removed.
  • No update functionality yet, this is a one way pull of data. BUT, my great friend +Matija Svoren has put together a great little framework for updating data from a Gapps spreadsheet, and I hope to document it and get it realeased sometime soon.
There is quite a bit of documentation in the code which is on google code. I hope someone will find this helfull, and even perhaps contribute to completing the concept.


Comments

Popular posts from this blog

A more sane approach to elastix call recordings

We put together this solution a while ago (thanks Brother Miles!), but never documented it, thought it would a good idea to put it here for anyone else who might need this (and anyone who uses Elastix for high call volume, probably does. The challenge. Elastix/Freepbx has good call recording abilities, but very strangely just dumps everything into a single directory. This can get REALLY bad if you have tens of thousands of calls per day, I have run accross a few scripts to convert and mode call recordings after they are saved, but that is a waste of resources, and makes it hard to integrate call recording UI's. So we figured out the 2 places that need to be changed so that all recorded calls are saved in a Year/Month/day file structure. Just 2 files For regular calls, we need to alter the included and symlinked extensions.conf, this is found at /etc/asterisk/extensions.conf we just need to add the macro-dialout-trunk-predial-hook, which already exists as a secti...

Cloud Enterprise Project/Program Management Tools

In our ongoing quest for an integrated, cloud/Open Source hybrid Business Operating System, we need to pick and implement a tool for project/Program management. Environment Our organization has 8 separate companies, which we need to track project progress across all 8.  For some companies, end users (project resources) will enter information themselves. For other companies and projects, a project co-ordinator will track progress manually from resource input. Task tracking can be on many levels, some projects will be quite detailed, other will be tracked at the milestone level only. Basic Requirements In order for this component to be successfull, it needs to satisfy the following requirements. Integrate with GApps for authentication. Integrate with GApps for document associations Support a fairly large number of project contributers/users (about 100). Handle multiple projects. Enable reporting on multiple levels, from detailed to executive overview. ...

Installing dependancies for Sun Ray on Centos 5.8

Ooo the beauty of Linux based proprietary thin clients... One of the best parts is that operating systems get updated, and SRSS doesn't. So re-installing/updating SRSS can be a bit of a moving target. So here are notes from my latest install. Dependencies and prerequisites yum install glib dhcp openldap-clients openldap tftp-server libXp openmotif22 openssl compat-libstdc++-33 libusb-devel compat-openldap gdbm.i386 openldap-devel pdksh libXfont yum groupinstall "Development Tools" wget http://pkgs.repoforge.org/htop/htop-1.0.1-1.el5.rf.x86_64.rpm yum install htop-1.0.1-1.el5.rf.x86_64.rpm (ok, not really required, but helpful on gauging load easily) wget ftp://mirror.switch.ch/pool/3/mirror/centos/5.8/os/i386/CentOS/glib-1.2.10-20.el5.i386.rpm yum install  glib-1.2.10-20.el5.i386.rpm --nogpgcheck -y cd /usr/lib ln -sf libldap-2.3.so.0.2.31 libldap.so.199 ln -sf libgdbm.so.2.0.0 libgdbm.so.3 ln -sf liblber-2.3.so.0.2.31 liblber.so.199 extract the include...