Google Apps Script Examples


Google Apps Scipt Examples


Google Apps Script (GAS) provides many different Services in the Google Sites and Docs cloud.

The Apps Script Editor is Available in Google Sites and Google Docs - Spreadsheets.

Apps Scripts are macros (in Javascript) that can automate tasks and connect data from Google Products/Services. 

Apps Script Services


Google Apps Script also support standalone GAS Gadgets , User interfaces, triggers etc.. for Google Sites and Google Docs.

The following are available/developing Services for Google Apps Script:

doGet Function



The doGet function in Google Apps Script allows you to embed an Apps Script into a webpage or have have it as a Standalone HTML App.


It is also possible to use GAS for Android, iPhone, Smartphone Webview Apps. These HTML Apps simply use a webpage instead of the native devices coding platform.


doGet Example using Sites Service

GAS Customized Functions:


In Google spreadsheets the GAS (Google Apps Scripts) can be run as a normal cell function.


eg. Cell Function:
=Sum(10*10)
Result:
100

Google Apps Script

Custom Cell Function:
=simpleEncode("Google Apps Script")



Invoking the Google Apps Script:


function simpleEncode(celltext) {
return encodeURIComponent(celltext.toString());
}

Returned Result in the Cell:

Google%20Apps%20Script


Note: Some Classes/APIs have cell invoking restrictions and return a no permission error.The onEdit Event trigger can be used as a workaround for more advanced control through cells.


GAS Spreadsheet Service
The Spreadsheet Service is a very powerful option for businesses , as most are already fimilar with some Spreadsheet Software/Cloudware formats on the market. . (ie OpenOffice, MS live)


Here is a Spreadsheet - Google Apps Script Example for submitting a form to a spreadsheet and processing the data through Apps Script a 'Trigger' - onFormSubmit.




New!  SuperGoopal Community


JOIN the SuperGoopal Community Now! Super Cloud Systems. Be part of the super social network, developer communities & support forums on Google+

Html Templates you can render as a Google Apps

Script Interface. For example: The jQuery UI library [Try Earlier jQuery UI releases first!] can now be used to input data back to a Google Apps Script. 

A lot of Google Sites Embed & Google Sites for Business examples can now be used in Google Apps Script with a tweaking of the Google Sites example code on this site. 

More Examples and best practices to come with further development testing of the new JavaScript standard
 ECMAScript 5.1. 

[Flash ActionScript 3 is also based on this EcmaScript standards. Flash developers may be familiar with a more object orientation of EcmaScript]

Browser compatibility and performance may still be an issue - if in doubt use the Google Apps Script editor to create a 'native' UI - user interface. This may be best practice for publicly publishing Google Apps Script Projects on the Chrome Web store.



Apps Script Service Examples:

(Example includes: Services & Classes: on form Submit, Spreadsheet Service,  Mail Service)
  • Contacts
  • DocList
  • Finance
  • JDBC
  • Language
  • Mail
  • Maps
 (Example includes:  Services & Classes: Spreadsheet Service, Spreadsheet Template)
(Example includes: Services & Classes: on form Submit, Mail Service)
  • UI
  • URLfetch
  • Utilities
  • XML 

Google API based Services

  • BigQuery (API)
  • URLshortener (API)
  • Prediction (API)
  • Tasks (API)
  • Adsense (API)
  • Analytics

New!

Third Party Apps Script Libraries


Third Party Apps Script Libraries for hooking to the main code via a Project key.These Service are not directly supported by Google. More Cloud System Examples will showcase the expanding scope of Google Apps Scripts. It would be best practice to be familiar with the developer of the Google Apps Script community, and their respective website should provide support and issue tracking.

Google apps Script Main editor >
Manage Library >
'Find a Library' >
Add the GAS Project Key
  • 2D arrays service
  • Youtube service
  • [Non Official] Google+ service
  • OAuth service
  • Fusion Tables service
and much more to come...

URLFetch Service


Using the URLFetch Service: you can use the oAuth config Class to connect to many different frameworks and APIs. 

eg. Google + , Amazon AWS , Yahoo, AOL ,Twitter, Facebook etc..

Apps Script Reference:






Authorizing Access/Google Account Security


In the Google Apps Script Gallery (Available within Google sites and Google docs) you have to authorize Apps Script to access your Google account information and documents.

View all your access Authorizations in your Google account:

Experimental Apps Script Services

  • Content Service 
  • DocsList Service 
  • Document Service 
  • Domain Service 
  • Groups Service 
  • Html Service 
  • JdbcE Service 
  • ScriptDb Service 
  • UiService 

Default Apps Script Services

  • Base Service
  • Cache Service
  • Calendar Service
  • Charts Service
  • Contacts Service
  • Finance Service
  • Gmail Service
  • Language Service
  • Lock Service
  • Mail Service
  • Maps Service
  • Properties Service
  • Script Service
  • Sites Service
  • Soap Service
  • Spreadsheet Service
  • UrlFetch Service
  • Utilities Service
  • Xml Service