0
votes

I have written a logic using Google Apps Script which will verify the logged in users email id with the one present in the database.If the email is present in database, populate the logged in user's email id in one of the cell.This should be done without manual intervention and onOpen event of spreadsheet and should also work if someone tries to make a copy of the same spreadsheet.

If method does not contain SQL statements then, onOpen() gets executed in both

  1. in the original sheet
  2. when someone makes copy of it,

If method contains SQL statements then, onOpen() gets executed ONLY

  1. in the original sheet (will not be executed if someone or even I, myself make copy of it).

Please confirm,

  1. if my understanding is correct and SQL statements does not work in onOpen() trigger when someone makes copy of the sheet.
  2. What could be the alternative to implement this functionality that gets executed in original sheet and in the copy(made using option Make a Copy)
1

1 Answers

0
votes

Don't name it onOpen, use something else so it runs under your userId and not each user. Doing that will break the copy since you will need to install the onOpenTrigger manually