Technical > Gscript for Gsheets
GScript is Javascript with Google Objects
Google Script (aka GScript or gScript) is "just" javascript with additional programming "objects" available to "do stuff" with google products/services. Example 1 is an example of a function. The syntax is all javascript as are the methods for declaring variables. Example 2 shows a for loop. Again, the syntax is all javascript, with various Google objects. Click image of either example for lightbox view. |
A Project
A "Project" is a single file that contains an entire scripting environment. It offers the ability to create script files, html files and other stuff all contained under a single file name. You can link and reference projects together as "libraries" and such.
There are two types of "projects".
Intrinsic Project -- The first type of project is an "intrinsic project" (my terminology for it). These projects are an inherent part of a google sheet, google doc or some other google file, and the project itself can not be seen nor found seperately by its project name in google drive. These projects enable the use of methods like "getActiveSpreadsheet" and "getActiveSheet", which are relative references that work because there is only one associated file.
Stand Alone Project - The second type uses the same interface, but the project (file) itself "stands alone". It's the same interface, but you create it from Google Drive just like you'd create a gDoc or gSheet. In my work thus far, I use these far less. If you were doing distributed programming and libraries, these would be your norm.
A "Project" is a single file that contains an entire scripting environment. It offers the ability to create script files, html files and other stuff all contained under a single file name. You can link and reference projects together as "libraries" and such.
There are two types of "projects".
Intrinsic Project -- The first type of project is an "intrinsic project" (my terminology for it). These projects are an inherent part of a google sheet, google doc or some other google file, and the project itself can not be seen nor found seperately by its project name in google drive. These projects enable the use of methods like "getActiveSpreadsheet" and "getActiveSheet", which are relative references that work because there is only one associated file.
Stand Alone Project - The second type uses the same interface, but the project (file) itself "stands alone". It's the same interface, but you create it from Google Drive just like you'd create a gDoc or gSheet. In my work thus far, I use these far less. If you were doing distributed programming and libraries, these would be your norm.
Code Snippets
Below are links leading to pages with code snippets for reference and learning
Below are links leading to pages with code snippets for reference and learning
Knowledge Base
Like the Gsheets section, the links above provide limited information about a few of the most used script snippetsG. This link to the right goes to a shared gDrive directory / Knowledge Base where there are individual files for the functions listed above plus many more files that detail numerous use scenarios, notable issues, and nuances. Please note, the files are .js (javascript) files. The do not execute anything. I use a programming text editor to take/make notes and I name the files .js files out of habit. Think of these as text files and open in text editors. |