Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Issue with onEdit(e) not triggering with BetterLog

I’m trying to trigger the function onEdit(e) but i got the following error:
Exception: You do not have permission to call SpreadsheetApp.openById. Autorisations required : https://www.googleapis.com/auth/spreadsheets
at setLogSheet_(Code:384:38)
at useSpreadsheet(Code:43:5)

I’m using BetterLog library, and it seems to come from the following code line:

var Logger = BetterLog.useSpreadsheet(sheetId);

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

When i remove from my code this specific line it works well.
After looking for a solution, i tried to add the following annotation
/**

  • @NotOnlyCurrentDoc
    */

but didn’t work…

>Solution :

SpreadsheetApp.openById requires permissions that are not available to simple triggers. You will have to use an installable trigger. Do not rename your function to onEdit otherwise you will be receiving two triggers which is not an easy thing to debug.

simple trigger restrictions

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading