Share code app script

25 views
Skip to first unread message

Pietro Bombardieri

unread,
Sep 29, 2022, 10:53:22 AMSep 29
to Google Apps Script Community
Hello,
I created a google sheets shared with same users
I created a code in app script: if I modify cell A, cell B return the date of modification


But it works only with me; if an other user modifies cell A, cell B dosen't return the date of modification

Do you know what's the problem?

Thank you

Pietro

CBMServices Web

unread,
Sep 29, 2022, 2:21:00 PMSep 29
to google-apps-sc...@googlegroups.com
Pietro,

Most likely cause is authorization of the script.

Have the other editor manually run the function to force the authorization pop up and from then on it should work for them.

Other option is ensuring the function can be run as a simple trigger with no authorization requirement  this means stripping out of the function anything that violates the simple trigger rules.


--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/2f7a5cfc-2af0-452e-8caa-d0d6e9e8d88bn%40googlegroups.com.

Pietro Bombardieri

unread,
Sep 30, 2022, 2:48:52 AMSep 30
to Google Apps Script Community
How can I turn the code in a simple trigger?

function onEdit(e) {
  if ([1].indexOf(e.range.columnStart) != -1) {
    e.range.offset(0, 83).setValue(new Date());
  }
}

Thank you

CBMServices Web

unread,
Sep 30, 2022, 3:39:07 AMSep 30
to google-apps-sc...@googlegroups.com
Just naming the function the reserved name "onEdit" turns it into a simple on edit trigger function.

But there are strict rules on what a simple trigger can do, you can only play with the spreadsheet container, don't try  to use other services like GmailApp or whatever. 

Hope that helps.

Reply all
Reply to author
Forward
0 new messages