G'day,
I have several Google Groups under a Google Apps account that my nonprofit uses. Some of these groups are quite large and managing their membership with the web UI is pretty awful.
I'm hoping someone can help me come up with a script that can synchronize a list that I maintain on a Google Docs Spreadsheet with a Group so that when I remove someone from the sheet, they get removed from the group -- and when someone gets added to the sheet, they get added to the group.
I was taking a look at the Directory API but I'm not savvy enough to figure out how to build a script for what I need. Side note, I did play around with a different script someone posted here that uses similar API methods, and I got that particular script to work -- so in other words, my account is now properly set up for API access.
Perhaps the easiest way to do this programmatically would be to delete the group's membership entirely, then add each member again, each time the script runs?
Thank you in advance for your assistance.
Here are several functions that you can use to accomplish what you would like.
First here is the removal process. As commented by Sandy, create a column that you will use to mark members for removal. You should be able use what ever you like here as long as the ones not being deleted are blank. You will need to change the variable "marked" to reflect that columns number, you will also need to do the same for the "email" variable. That being the column that holds the users emails.
Make a copy of your sheet first and make sure that when the rows are deleted that they are the correct ones!
Lastly here are some other functions for managing groups, use them as needed. Probably best to create a menu that you can just call these from inside the spreadsheet.
This should help you get a nice finished product.
Edited Code to handle reported errors in the comments. Also updated the marked column must use an "x" for marker to be removed. Lastly to properly handle the deletion of the row, you need to clear it and then sort the entire sheet or your will get wrong rows removed. Remember to adjust to your parameters.