I want to show a pop up window asking user to abide by some rules and then grant him the rights for editing the sheet in google sheet using google script. If he clicks 'Agree' he is given rights and if clicks 'Not Agree' then he wont be able to edit that sheet. I can show a pop up with required options. But how can I add the user dynamically to editors list and when he closes the sheet he gets removed from that?
I tried protect sheets and add/remove users who click on the appropriate buttons. But this doesnt work. Users cannot add/remove themselves because they dont have rights. Can I run a script with script author rights who can add/edit editors?