|
1 | 1 | ---
|
2 |
| -title: Give external users access to resources |
3 |
| -description: Scale access to external vendors and customers via a Google Sheet |
4 |
| -and a Google Group. |
5 |
| -labels: Apps Script, Sheets, Groups for Business |
6 |
| -material_icon: assignment turned in |
| 2 | +title: Scale access to external vendors and partners |
| 3 | +description: Share documents, events, and communications with users outside |
| 4 | +your domain |
| 5 | +labels: Sheets, Groups for Business, Apps Script |
| 6 | +material_icon: group_work |
7 | 7 | create_time: 2019-08-30
|
8 |
| -update_time: 2019-09-17 |
| 8 | +update_time: 2019-12-27 |
9 | 9 | ---
|
10 |
| - |
11 | 10 | Contributed by Tech and Eco, follow me on
|
12 | 11 | [Twitter](https://twitter.com/TechandEco)!
|
13 | 12 |
|
14 |
| -You may manage multiple Google Groups for your organization and wish to |
15 |
| -streamline this process, especially if you have to manually send an email upon |
16 |
| -granting users membership. The following Google Spreadsheet contains a script |
17 |
| -that helps add the email address of a user to a G Suite Google Group, |
18 |
| -and then sends them an email confirming they have been added. |
| 13 | +Use a Google Group to work cross-functionally with vendors, partners, |
| 14 | +customers, and volunteers outside of your domain, and scale access |
| 15 | +to work assignments and leverage security controls. You can add an external |
| 16 | +user's Google email (this can be their own G Suite account, a G Suite user |
| 17 | +account you created for them within your domain, or a free Gmail account) to |
| 18 | +your G Suite Google group (not available for consumer Google Groups) via a |
| 19 | +Google Sheet to manage users in bulk and keep track of the onboarding history. |
| 20 | + |
| 21 | +Top 6 benefits of this solution: |
| 22 | + |
| 23 | + 1. Adds a new external user to a G Suite Google Group you create |
| 24 | + (example: [email protected]) once, and it allows users to open all |
| 25 | + resources that are shared with that group moving forward (calendar, files, |
| 26 | + training site, dashboards (built on DataStudio), etc. |
| 27 | + |
| 28 | + 1. When adding one or more users to your Google Group, users can receive a |
| 29 | + welcome email with the links they can access. Creating a Google Site is |
| 30 | + optional but recommended to centralize information in a |
| 31 | + beautiful website interface. |
| 32 | + |
| 33 | + 1. The template of the welcome email is composed in a Google Doc. You |
| 34 | + can use seperate Google Docs for different recipients to customize |
| 35 | + messaging. |
| 36 | + |
| 37 | + 1. Capture the email addresses of users in your Sheet, and add them in bulk to |
| 38 | + the desired Google Groups at a later time by changing the column "Allowed" |
| 39 | + to "yes" for each row of users. |
| 40 | + |
| 41 | + 1. You or members of your team, can add users to different Google Groups as |
| 42 | + long as the person who made a copy of this sheet has |
| 43 | + _manager_ or _owner_ rights in each of those Google Groups. |
| 44 | + |
| 45 | + 1. Removing a user from a Group (via the Google Group's interface) will revoke |
| 46 | + their access to all resources. You can also limit documents to be available |
| 47 | + to that group for a |
| 48 | + [specific period of time](https://support.google.com/docs/answer/2494893?co=GENIE.Platform%3DDesktop&hl=en). |
| 49 | + |
| 50 | + |
19 | 51 |
|
20 | 52 | ## Technology highlights
|
21 | 53 |
|
22 |
| -* Using the `onEdit` _simple trigger_ in a Google Sheet, you can grant access |
23 |
| - to multiple resources from a spreadsheet. |
24 |
| - To learn more [click here](https://developers.google.com/apps-script/guides/triggers/#onedite) |
25 |
| -* Manage group members using the |
26 |
| - [Admin Directory](https://developers.google.com/admin-sdk/directory/v1/guides/manage-group-members) |
27 |
| -* A _Google Document_ is used as the email's _template_. |
| 54 | +- Install a trigger with a click so the script is setup to run everytime the |
| 55 | +Sheet is edited. To learn more visit |
| 56 | + [this page](https://developers.google.com/apps-script/guides/triggers/installable)) |
| 57 | +- Add members to a _Google Group for Business_ using the |
| 58 | + [Admin Directory API](https://developers.google.com/apps-script/advanced/admin-sdk-directory) |
28 | 59 |
|
29 | 60 | ## Try it
|
30 | 61 |
|
31 |
| -1. Make a [copy of this Google Spreadsheet](https://docs.google.com/spreadsheets/d/1kNuOc_evfqbu8dVJIA5N4r27d_Ubnr915eln4cbq2cU/copy) from your G Suite account. |
32 |
| -1. From your spreadsheet, click on **Tools > Script Editor**. This will bring |
33 |
| - you to the _Apps Script editor_. |
34 |
| -1. Ensure the **Admin Directory API** is enabled via |
35 |
| - **Resources > Advanced Google Services**. |
36 |
| -1. Now run the script by clicking the **Select function** drop down > choose **"installTrigger."** Then click the Run button (►). This will create a |
37 |
| - trigger for your sheet automatically. |
| 62 | +1. Make a [copy of this Google Spreadsheet](https://docs.google.com/spreadsheets/d/1KJKc2DcCr2bHLCq5Judvvwuen3k3ifFY8wtQWKfHDXU/copy) from your _G Suite_ account. |
| 63 | + |
| 64 | +1. Enter for testing purposes a _Gmail address you own_ and a Google Group you |
| 65 | + have _rights to manage_ its membership. |
38 | 66 |
|
39 |
| - > _Caution_: If you run this script _more than once_, it will generate |
40 |
| - > _multiple triggers_ causing duplicate emails. Ensure you run the script |
41 |
| - > once and that there aren't multiple triggers on the triggers page. |
42 |
| - > You can visit the triggers page by clicking the _trigger icon_ (which |
43 |
| - > looks like a clock from the script's page. |
| 67 | + > _Note_: The membership status will be populated by the words |
| 68 | + **Newly added** if the |
| 69 | + > user was added to the group, or **Already added** if it recognizes the user |
| 70 | + > is already a member of that group. |
| 71 | +
|
| 72 | +1. Enter “yes” in the “Allowed” column. |
| 73 | +1. Let’s visit the code now by clicking on **Tools > Script Editor**. |
| 74 | +1. Ensure the _Admin Directory API_ is enabled via |
| 75 | + **Resources > Advanced Google Services**. |
| 76 | +1. Create a trigger by clicking the clock-like icon and choosing the |
| 77 | + “onEditInstallableTrigger” function from the drop-down to run the event on |
| 78 | + “onOpen” |
| 79 | +1. Return to the script page and _run the script_ by clicking the |
| 80 | + **"Select function"** drop down > |
| 81 | + choose **"onEditInstallableTrigger."** Then click the Run button (►). |
| 82 | + This will create a trigger for your sheet automatically. |
44 | 83 |
|
45 | 84 | 1. When prompted, click the **Review permissions** and click **Allow** so the
|
46 |
| - script can email on your behalf. |
47 |
| - |
48 |
| - > _Important_: If you get the warning **This app isn't verified**, continue |
49 |
| - > with the verification process by clicking **Advanced** and then scroll |
50 |
| - > down and click the grey text at the bottom that says |
51 |
| - > **Go to (Copy this external-access to a Google Group via onEdit Sheet** |
52 |
| -
|
53 |
| -1. After granting permissions, return to your spreadsheet and _type an email |
54 |
| - address_ in the `Email` column and the _group address_ in the `Google Group` |
55 |
| - column, and the word `yes` in the `Allowed` column. |
56 |
| - |
57 |
| - > _Note_: if you do not populate the column `allowed` with the word `yes`, |
58 |
| - > the script is instructed to _not run_. This is helpful if you wish to |
59 |
| - > capture requests to join a group in the sheet but not add them the users |
60 |
| - > yet until you populate the **allowed** column. |
61 |
| -
|
62 |
| -1. To _test_, enter _your own email_ and a Google Group that you already |
63 |
| - are a member of and have _manager rights_ to adding members in order to |
64 |
| - receive the confirmation email. |
65 |
| - |
66 |
| -## Optionally customize your email template |
67 |
| - |
68 |
| -1. _[optional]_ You can modify the font, color, and images of your email |
69 |
| - template by [making a copy of this doc](https://docs.google.com/document/d/1-ajkkIP8gUWqMcnpXhkqwlM_2Y18USLdJ-pFZdDEZ70/copy). Then copy its |
70 |
| - URL address and replace the one listed in the vairable `addedToGroupDocId` |
71 |
| - in the sheet's script. |
72 |
| - |
73 |
| - > _Note_: `{{EMAIL}}` and `{{GOOGLE_GROUP}}` are placeholders in your |
74 |
| - > template that insert the values from the Google Sheet. In order for |
75 |
| - > external users to receive the template's format, the Google doc's |
76 |
| - > permissions must be set to **Viewable by anyone with this link**; and at |
77 |
| - > least **Viewable by anyone in your organization** to share with anyone |
78 |
| - > in your domain. |
79 |
| -
|
80 |
| -1. _[optional]_ To modify the _subject line_ of the confirmation email, enter |
81 |
| - the desired message in the variable `addedToGroupSubject` in the sheet's |
82 |
| - script. |
| 85 | + script can email on your behalf. |
| 86 | + |
| 87 | + > _Note_: If you get a warning that **This app isn't verified** continue |
| 88 | + > with the verification process by clicking **Advanced** and then scroll |
| 89 | + > down and click the grey text at the bottom that begins with **Go to...** |
| 90 | +
|
| 91 | +1. Check your inbox and Google Group’s interface under it’s _members_ section. |
| 92 | + |
| 93 | +## _[optional]_ Customize your messaging |
| 94 | + |
| 95 | +- If you wish to change the subject lines of your emails, replace |
| 96 | + the text in the “Email subject” column. |
| 97 | + |
| 98 | +- If you wish to change the email template that is sent out, replace the URL |
| 99 | + in the “Email template” column with your preferred Google Doc. If you wish |
| 100 | + to include any of the column values in the template, enter them as such in |
| 101 | + the template {{Column_name}} like this: _Welcome, we have added your |
| 102 | + {{Email}} to this {{Google_Group}} in order give you access to the following |
| 103 | + resources..._ |
| 104 | + > _Note_: If you encounter any issues with the welcome email, change the |
| 105 | + > permission levels of the Google Doc templates to more open settings. |
83 | 106 |
|
84 | 107 | ## Next steps
|
85 | 108 |
|
|
0 commit comments