Have you ever wanted to have a Google Sheet available for only those users who need to edit and then once they are done, take their edit permissions away to maintain the integrity of the sheet?
I know that I have come across these conditions a number of times in the past. Maybe you have a task list that you want to send your team each time a task is allocated to them. Once they let you know that they are done, by say, entering a set of values or checking a task complete box on the row they need to work on, you want to be able to remove their edit permissions from your sheet.
In this post, we have created a Google Apps Script that will add and remove editors to a Google Sheet based on the spreadsheet’s data. More specifically, this script will:
- Grab the users name and email in each row along with whether or not they have complete the task or if the Google Sheet has been shared and sent to the user.
- Share the assigned user to the Google Sheet.
- Send an email to the user. A separate Google Sheet tab is added to the sheet so an administrator can add their custom email message.
- Automatically check a reference column of checkboxes indicating that the assigned user has been shared as an editor on the Google Sheet and an email has been sent to them.
- Once the task has been complete the user check the “Edit Complete” checkbox in their assigned row.
- Either automatically each day or when the Google Sheets administrator clicks the button, each user who has completed all assigned tasks is removed from having edit permissions to the Google Sheet.
The best way to probably understand this script is through an example…