There are various options for publishing apps script projects as “Add-Ons”.
You can read more here
Another option could be to publish your script code via something like GitHub. You could use Clasp to create and maintain a local repository, and sync to GitHub for sharing. Anyone that has a copy of your Glide app could then apply your script by reversing the process, ie. clone your GitHub repo, and then import into a ScriptApp project using clasp. A bit cumbersome, but should work.
Does @anyone have an example of a Glide app with a similar practice?
Keen to see the documentation and the implementation of a GitHub/ Add-on based app?
I use Apps Script extensively in my GSheets projects, and have been using the Clasp/GitHub combination for versioning/source control for a few years now. It works well, and allows me to sleep a bit easier
I’m quite new to Glide, and so I haven’t yet had the need to share any apps script code associated with a Glide project. But I see no reason why this approach wouldn’t work.
The answer to that I think depends on the purpose of the trigger.
If your app requires triggers in order to function correctly, then anyone who copies your app would need to install those triggers after copying the script code.
What you could do is include a README file as part of the repository with setup instructions.
Note that it is also possible to install triggers programatically, so if you wanted to get fancy you could include a “run once” function that installs any required triggers.
EDIT: Here is an example of a script that I sometimes use to install triggers. It gets called with the name of the function that I want called for each event, ie. on_form_submit, on_sheet_edit or on_sheet_change
function start_trigger(func) {
var ss = SpreadsheetApp.getActive();
switch (func) {
case 'on_form_submit':
ScriptApp.newTrigger(func)
.forSpreadsheet(ss)
.onFormSubmit()
.create();
break;
case 'on_sheet_edit':
ScriptApp.newTrigger(func)
.forSpreadsheet(ss)
.onEdit()
.create();
break;
case 'on_sheet_change':
ScriptApp.newTrigger(func)
.forSpreadsheet(ss)
.onChange()
.create();
break;
}
}