0

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!

Artem
  • 11
  • 1
  • what have you tried so far ? the question needs sufficient code for a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – D.L Jul 31 '23 at 12:28
  • If my understanding of your question is correct, I thought that this thread might be an answer to your question. https://stackoverflow.com/q/70367955 In this case, the OnEdit of the simple trigger cannot be used because of the current specification of the service account. It is required to use the OnEdit of the installable trigger. If I misunderstood your question, I apologize. – Tanaike Jul 31 '23 at 12:57

0 Answers0