I have a Google sheet template which contains an appscript module. This module includes a OnEdit(e) function.
I have to copy this template 20x every months, pre-complete it and share each of them with different people.
I started automating this copy using Python libraries google-api-python-client
and gspread
.
For this copy process, i use a GCP service account, the final aim is to put the code on a Cloud run services and give an url to each person who will be able to call the url every time they need a new copy, and got their fresh new copy of the template.
This part works well actually, except that the OnEdit(e) function is not working on those copy. This can be linked to the service account usage part (maybe?).
Is there a way to make this copy functional with the OnEdit(e) simple trigger??
My current workaround is to go in each copy, open appscript and copy the code to be owned by my personal account, but it's not a suitable solution in the matter of full automation...
I tried to make a library out of my code, in order to keep the ownership of this code with my personal account on every copies, but the onEdit(e) function is not activated in this scenario. The "simple trigger" part doesn't seems to be activated when the function is in a library...
I tried to inject a trigger on edit calling the lib's 'on edit' function with python, but it's been failing so far...
Thanks for your help!