The other answer (Phil Bozak) is not bad, as it gives a general overview of how to build a library, but I am afraid that this is not enough to put you on the “right path”.
As mentioned in the documentation, you can use your included library in the same way as using the default service , which means that library functions are not directly accessible as a script, but rather should be considered as a toolbar that can call script functions.
So, in each of your spreadsheets you should have a number of elementary functions that actually “call” the library service, and the latter takes care of the real action.
Let me give you a simple example: suppose you want to change the background color of a sheet, you have a function in yourLibrary that changes the color of the current sheet ( yourLibrary is the name you gave the library), this function will be called changeColor .
Now in the script you can use yourLibrary.changeColor , but this "utility call" must be present in the script spreadsheet itself if you want it to be performed by a special action (onEdit, onOpen ... or in the menu call), and the library should be listed in the registry of the same script editor.
All this explains that the library function is very useful and very simple, but you still need a “skeleton script” in each table, and you will have to think about how to rebuild your script with a basic structure that calls the “ updatable parts that make the real stuf ".
Not so simple, but (after that done) quite comfortable; -)
Hoping this is clear enough.
Serge insas
source share