-1

I have a Google sheet with a function that enters a timestamp in a column if the column to its left is updated. It is triggered by the simple onedit trigger, and it only processes for a small set of cells in the sheet. It has worked fine for months with many people.

Then I added a script to do some data cleanup on a separate tab of the same doc. I use an installable trigger, so that I can schedule the cleanup to run once each week.

Unfortunately, while the scheduled installable trigger cleanup routine now works, the original onedit simple trigger timestamp routine does not. To be more precise, the timestamp routine works for me, the author of the script, but it does not work for anyone else.

Any idea how to address this?

Thank you!

  • It's unclear what your question is. You probably want to show a [mcve] and describe the exact error message you get and under what specific circumstances. –  Oct 22 '18 at 18:09

1 Answers1

2

the timestamp routine works for me, the author of the script, but it does not work for anyone else.

Issue can be found in Stackdriver logs. Go to Script Editor>View> Executions>Clear all filters. Check the failed logs. Most possible reason is You restricted access to those people. If the "user at the keyboard" is not permitted to do something manually, He cannot do that through scripts either. Another possible reason is Anonymous edits cannot show popups/dialogs; If you added such code to your function, Your function will fail.

Possible Solution(s):

  • Provide the necessary permission or

  • Create a installable onEdit trigger, so that the function will run under your authority. In this case, if editors are able to access your editor, they may be able to execute scripts as you. Protecting all sheets with unprotected ranges may help this, but does not provide complete security. Reducing authorised access scope might also help

  • Another way to do this is by creating a service account and use oauth library to access the sheet.Sample here and here.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
  • 1
    If people knew how to go to `Script Editor>View> Executions` the world would just be better haha. – Marios Sep 11 '20 at 09:00
  • 1
    @Marios Maybe I should add a self answered Q/A for that purpose. So when people ask it, we can direct them to that or close it until they figure out the actual error. – TheMaster Sep 11 '20 at 09:03
  • 1
    yes I believe that this is good idea. With detailed explanation accompanied by screenshots so it is clear to everybody how they can get there. – Marios Sep 11 '20 at 09:04
  • Would you do the honors? – TheMaster Sep 11 '20 at 09:05
  • if that can wait until tomorrow yes. Otherwise feel free to post it and I will support it of course. I need some time to structure a good question and a good answer as well. – Marios Sep 11 '20 at 09:07
  • @Marios Or alternatively, You can add a answer to this question. https://stackoverflow.com/questions/16089041/how-can-i-test-a-trigger-function-in-gas What do you think? – TheMaster Sep 11 '20 at 09:07
  • I will give it a thought an keep you posted. Thanks. It seems like a relevant post to me. However, I am afraid that it will be overlapped by the other great answers. – Marios Sep 11 '20 at 09:50
  • @Marios On the flip side, it is a popular question and it's easy for your answer to shine, if you beat out the competition. The accepted answer is not that relevant now. There are no detailed screenshots in any of the answers either. Of course it's still your choice. – TheMaster Sep 11 '20 at 09:56
  • that is a valid point indeed. I will try to structure an answer and post it if I believe it adds enough value. Thanks – Marios Sep 11 '20 at 10:02
  • @Marios I went ahead and added a answer there. But I haven't added any screenshots(Don't really like them). You can add another answer, if you think it'll help. But I'm hoping to close all these type error questions as a dupe target of that one. – TheMaster Sep 11 '20 at 16:49