I have developed several general purpose script functions, for Google Spreadsheet apps.
Currently I keep each function in an individual file on my lap-top. In order to include them
into a spreadsheet, I only know of one way.
Merge the individual function-files into one file.
Then copy and paste the data in the merged file into the
spreadsheet’s script editor, replacing the previous content.
It would be nice if there was a way (e.g. using a “project”) where
the individual function files could be saved once and then I could
just reference those functions as needed in a new script.
I don’t know if there is such a possibility. I only see one node
called “code” in the tree list of the spreadsheet content.
Any help is appreciated.
Thanks Serge. I looked into “Libraries” here is what I found.
Any spreadsheet file which contains one or more Script Projects can be referenced as a
Library. The script_project makes up the library definition.
A spreadsheet file can contain one or more script_projects.
The interface to script functions is found under the “tools” menu
in the spreadsheet file. This menu contains three (3) entries related
to scripts:
a. This entry provides a list view of all the projects and functions
found in each “project”. The list is sorted by function_name, then
project_name. The third column is “service” which I currently only
find a value of “spreadsheet”. I have not explored other types of
documents, “sites” and “services” to know what else can appear.
b. At the bottom of this display is a menu of what actions you can
perform on the list entries: Run, Edit, New, Close.
– Run: executes the highlighted script.
– Edit: opens the “Script Editor” on the selected project/function.
This is the same the third (3) on the “tools” menu (see below).
– New. opens the “Script Editor” on an untitled (empty) projects. This
the same action that selecting “Script Editor” option from the “tools”
menu when there are no previously saved scripts.
– Close: this closes the Script Manager window. This is the same as
pressing the “X” button in the top right corner.
Script Editor.
This provides you access to functions for manipulating:
a. LIBRARY – a script PROJECT with a defined version number
b. PROJECT – a collection of one or more FILEs.
c. FILE – a collection of one or more JavaScript FUNCTIONs.
d. FUNCTION – A set of JavaScript statements that can be referenced
(called) by either a Spreadsheet interface or another
JavaScript FUNCTION.