Skip to content

Commit 082c00e

Browse files
committed
Update getGroupSettings.gs
1 parent 47906d4 commit 082c00e

File tree

1 file changed

+75
-106
lines changed

1 file changed

+75
-106
lines changed

getGroupSettings.gs

+75-106
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ function getGroupsSettings() {
7070
groupSettingsSheet.setColumnWidth(3, 275);
7171
groupSettingsSheet.setFrozenColumns(2);
7272

73+
// Hide column A
74+
groupSettingsSheet.hideColumn(groupSettingsSheet.getRange("A:A"));
75+
7376
// Add notes to specified cells
7477
groupSettingsSheet
7578
.getRange("E1")
@@ -109,9 +112,9 @@ function getGroupsSettings() {
109112
groupSettingsSheet
110113
.getRange("I1")
111114
.setNote(
112-
"Specifies the set of users for whom this group is discoverable. Possible values are:\n" +
113-
" ANYONE_CAN_DISCOVER: The group is discoverable by anyone searching for groups.\n" +
114-
" ALL_IN_DOMAIN_CAN_DISCOVER: The group is only discoverable by users within the same domain as the group.\n" +
115+
"Specifies the set of users for whom this group is discoverable.\n\n" +
116+
" ANYONE_CAN_DISCOVER: The group is discoverable by anyone searching for groups.\n\n" +
117+
" ALL_IN_DOMAIN_CAN_DISCOVER: The group is only discoverable by users within the same domain as the group.\n\n" +
115118
" ALL_MEMBERS_CAN_DISCOVER: The group is only discoverable by existing members of the group.",
116119
);
117120

@@ -128,224 +131,174 @@ function getGroupsSettings() {
128131
groupSettingsSheet
129132
.getRange("J1")
130133
.setNote(
131-
"Identifies whether members external to your organization can join the group. Possible values are:\n\n" +
132-
"true: Google Workspace users external to your organization can become members of this group.\n\n" +
133-
"false: Users not belonging to the organization are not allowed to become members of this group.",
134+
"Identifies whether members external to your organization can join the group.\n\n" +
135+
" true: Google Workspace users external to your organization can become members of this group.\n\n" +
136+
" false: Users not belonging to the organization are not allowed to become members of this group.",
134137
);
135138

136139
groupSettingsSheet
137140
.getRange("K1")
138141
.setNote(
139-
"Allows posting from web. Possible values are:\n\n" +
140-
"true: Allows any member to post to the group forum.\n\n" +
141-
"false: Members only use Gmail to communicate with the group.",
142+
"Allows posting from web.\n\n" +
143+
" true: Allows any member to post to the group forum.\n\n" +
144+
" false: Members only use Gmail to communicate with the group.",
142145
);
143146

144147
groupSettingsSheet
145148
.getRange("L1")
146149
.setNote(
147-
"The primary language for the group. Use the language tags in the Supported languages table.",
150+
"The primary language for the group.",
148151
);
149152

150153
groupSettingsSheet
151154
.getRange("M1")
152155
.setNote(
153-
"Allows the Group contents to be archived. Possible values are:\n\n" +
154-
"true: Archive messages sent to the group.\n\n" +
155-
"false: Do not keep an archive of messages sent to this group. If false, previously archived messages remain in the archive.",
156+
"Allows the Group contents to be archived.\n\n" +
157+
" true: Archive messages sent to the group.\n\n" +
158+
" false: Do not keep an archive of messages sent to this group.",
156159
);
157160

158161
groupSettingsSheet
159162
.getRange("N1")
160163
.setNote(
161-
"Allows the group to be archived only. Possible values are:\n\n" +
162-
"true: Group is archived and the group is inactive. New messages to this group are rejected. The older archived messages are browseable and searchable.\n\n" +
163-
"If true, the whoCanPostMessage property is set to NONE_CAN_POST.\n\n" +
164-
"If reverted from true to false, whoCanPostMessages is set to ALL_MANAGERS_CAN_POST.\n\n" +
165-
"false: The group is active and can receive messages.\n\n" +
166-
"When false, updating whoCanPostMessage to NONE_CAN_POST, results in an error.",
164+
"Allows the group to be archived only.\n\n" +
165+
" true: Group is archived and the group is inactive.\n\n" +
166+
" false: The group is active and can receive messages.",
167167
);
168168

169169
groupSettingsSheet
170170
.getRange("O1")
171171
.setNote(
172-
"Moderation level of incoming messages. Possible values are:\n\n" +
173-
"MODERATE_ALL_MESSAGES: All messages are sent to the group owner's email address for approval. If approved, the message is sent to the group.\n\n" +
174-
"MODERATE_NON_MEMBERS: All messages from non group members are sent to the group owner's email address for approval. If approved, the message is sent to the group.\n\n" +
175-
"MODERATE_NEW_MEMBERS: All messages from new members are sent to the group owner's email address for approval. If approved, the message is sent to the group.\n\n" +
176-
"MODERATE_NONE: No moderator approval is required. Messages are delivered directly to the group.",
172+
"Moderation level of incoming messages.\n\n" +
173+
" MODERATE_ALL_MESSAGES: All messages are sent to the group owner's email address for approval.\n\n" +
174+
" MODERATE_NON_MEMBERS: All messages from non group members are sent to the group owner's email address for approval.\n\n" +
175+
" MODERATE_NEW_MEMBERS: All messages from new members are sent to the group owner's email address for approval.\n\n" +
176+
" MODERATE_NONE: No moderator approval is required.",
177177
);
178178

179179
groupSettingsSheet
180180
.getRange("P1")
181181
.setNote(
182-
"Specifies moderation levels for messages detected as spam. Possible values are:\n\n" +
183-
"ALLOW: Post the message to the group.\n\n" +
184-
"MODERATE: Send the message to the moderation queue. This is the default.\n\n" +
185-
"SILENTLY_MODERATE: Send the message to the moderation queue, but do not send notification to moderators.\n\n" +
186-
"REJECT: Immediately reject the message.",
182+
"Specifies moderation levels for messages detected as spam.\n\n" +
183+
" ALLOW: Post the message to the group.\n\n" +
184+
" MODERATE: Send the message to the moderation queue.\n\n" +
185+
" SILENTLY_MODERATE: Send the message to the moderation queue.\n\n" +
186+
" REJECT: Immediately reject the message.",
187187
);
188188

189189
groupSettingsSheet
190190
.getRange("Q1")
191191
.setNote(
192-
"Specifies who receives the default reply. Possible values are:\n\n" +
193-
"REPLY_TO_CUSTOM: For replies to messages, use the group's custom email address.\n" +
194-
" - When ReplyTo is set to REPLY_TO_CUSTOM, customReplyTo must have a value, otherwise an error is returned.\n\n" +
195-
"REPLY_TO_SENDER: The reply sent to author of message.\n\n" +
196-
"REPLY_TO_LIST: This reply message is sent to the group.\n\n" +
197-
"REPLY_TO_OWNER: The reply is sent to the owner(s) of the group. This does not include the group's managers.\n\n" +
198-
"REPLY_TO_IGNORE: Group users individually decide where the message reply is sent.\n\n" +
199-
"REPLY_TO_MANAGERS: This reply message is sent to the group's managers, which includes all managers and the group owner.",
192+
"Specifies who receives the default reply.\n\n" +
193+
" REPLY_TO_CUSTOM: For replies to messages, use the group's custom email address.\n\n" +
194+
" REPLY_TO_SENDER: The reply sent to author of message.\n\n" +
195+
" REPLY_TO_LIST: This reply message is sent to the group.\n\n" +
196+
" REPLY_TO_OWNER: The reply is sent to the owner(s) of the group.\n\n" +
197+
" REPLY_TO_IGNORE: Group users individually decide where the message reply is sent.",
200198
);
201199

202200
groupSettingsSheet
203201
.getRange("R1")
204202
.setNote(
205-
"An email address used when replying to a message if the replyTo property is set to REPLY_TO_CUSTOM. This address is defined by an account administrator.\n\n" +
206-
"When the group's ReplyTo property is set to REPLY_TO_CUSTOM, the customReplyTo property holds the custom email address used when replying to a message.\n\n" +
207-
"If the group's ReplyTo property is set to REPLY_TO_CUSTOM, the customReplyTo property must have a text value, otherwise an error is returned.",
203+
"An email address used when replying to a message if the replyTo property is set to REPLY_TO_CUSTOM.",
208204
);
209205

210206
groupSettingsSheet
211207
.getRange("S1")
212208
.setNote(
213-
"Whether to include a custom footer. Possible values are:\n\n" +
214-
"true: Include the custom footer text set in the `customFooterText` property.\n\n" +
215-
"false: Don't include a custom footer.",
209+
"Whether to include a custom footer.\n\n" +
210+
" true: Include the custom footer text.\n\n" +
211+
" false: Don't include a custom footer.",
216212
);
217213

218214
groupSettingsSheet
219215
.getRange("T1")
220216
.setNote(
221-
"Sets the content of the custom footer text. Maximum characters: 1,000.\n\n" +
222-
"Note: Custom footers only appear in emails sent from the group, not when viewing messages within Google Groups.",
217+
"Sets the content of the custom footer text.",
223218
);
224219

225220
groupSettingsSheet
226221
.getRange("U1")
227222
.setNote(
228-
"Allows a member to be notified if their message to the group is denied by the group owner. Possible values are:\n\n" +
229-
"true: Send a notification to the message author when their message is rejected. The content of the notification is set in the `defaultMessageDenyNotificationText` property.\n\n" +
230-
" - Note: The `defaultMessageDenyNotificationText` property only applies when `sendMessageDenyNotification` is set to `true`.\n\n" +
231-
"false: No notification is sent to the message author when their message is rejected.",
223+
"Allows a member to be notified if their message to the group is denied by the group owner.",
232224
);
233225

234226
groupSettingsSheet
235227
.getRange("V1")
236228
.setNote(
237-
"Enables the group to be included in the Global Address List. For more information, see the help center. Possible values are:\n" +
238-
" true: Group is included in the Global Address List.\n" +
239-
" false: Group is not included in the Global Address List.",
229+
"Denied Message Notification Text.",
240230
);
241231

242232
groupSettingsSheet
243233
.getRange("W1")
244234
.setNote(
245-
"Enables members to post messages as the group. Possible values are:\n" +
246-
" true: Group member can post messages using the group's email address instead of their own email address. Messages appear to originate from the group itself.\n" +
247-
" Note: When true, any message moderation settings on individual users or new members do not apply to posts made on behalf of the group.\n" +
248-
" false: Members cannot post in behalf of the group's email address.",
235+
"Enables members to post messages as the group.",
249236
);
250237

251238
groupSettingsSheet
252239
.getRange("X1")
253240
.setNote(
254-
"Enables the group to be included in the Global Address List. For more information, see the help center. Possible values are:\n" +
255-
" true: Group is included in the Global Address List.\n" +
256-
" false: Group is not included in the Global Address List.",
241+
"Enables the group to be included in the Global Address List.",
257242
);
258243

259244
groupSettingsSheet
260245
.getRange("Y1")
261246
.setNote(
262-
"Permission to leave the group. Possible values are:\n" +
263-
" ALL_MANAGERS_CAN_LEAVE: Group managers can leave the group.\n" +
264-
" ALL_MEMBERS_CAN_LEAVE: All group members can leave the group.\n" +
265-
" NONE_CAN_LEAVE: No one can leave the group. Group ownership can only be transferred.",
247+
"Permission to leave the group.",
266248
);
267249

268250
groupSettingsSheet
269251
.getRange("Z1")
270252
.setNote(
271-
"Permission to contact owner of the group via web UI. Possible values are:\n" +
272-
" ALL_IN_DOMAIN_CAN_CONTACT: Anyone within the same domain as the group can contact the owner.\n" +
273-
" ALL_MANAGERS_CAN_CONTACT: Only group managers can contact the owner.\n" +
274-
" ALL_MEMBERS_CAN_CONTACT: All group members can contact the owner.\n" +
275-
" ANYONE_CAN_CONTACT: Anyone can contact the owner via the web UI.",
253+
"Permission to contact owner of the group via web UI.",
276254
);
277255

278256
groupSettingsSheet
279257
.getRange("AA1")
280258
.setNote(
281-
"Indicates if favorite replies should be displayed before other replies.\n" +
282-
" true: Favorite replies are displayed at the top, above other replies.\n" +
283-
" false: Favorite replies are displayed alongside other replies in the conversation order.",
259+
"Indicates if favorite replies should be displayed before other replies.",
284260
);
285261

286262
groupSettingsSheet
287263
.getRange("AB1")
288264
.setNote(
289-
"Specifies who can deny membership to users. This permission will be deprecated once it is merged into the whoCanModerateMembers setting.\n" +
290-
" ALL_MEMBERS: All group members can deny membership requests.\n" +
291-
" OWNERS_AND_MANAGERS: Only group owners and managers can deny membership requests.\n" +
292-
" OWNERS_ONLY: Only group owners can deny membership requests.\n" +
293-
" NONE: No one can deny membership requests (automatic approval).",
265+
"Specifies who can deny membership to users.",
294266
);
295267

296268
groupSettingsSheet
297269
.getRange("AC1")
298270
.setNote(
299-
"Specifies who can manage members (approve/deny membership requests, remove members). Possible values are:\n" +
300-
" ALL_MEMBERS: All group members can manage members.\n" +
301-
" OWNERS_AND_MANAGERS: Only group owners and managers can manage members.\n" +
302-
" OWNERS_ONLY: Only group owners can manage members.\n" +
303-
" NONE: No one can manage members except the group owner (automatic approval for membership requests).",
271+
"Specifies who can manage members.",
304272
);
305273

306274
groupSettingsSheet
307275
.getRange("AD1")
308276
.setNote(
309-
"Specifies who can moderate content (approve/reject/remove messages). Possible values are:\n" +
310-
" ALL_MEMBERS: All group members can moderate content.\n" +
311-
" OWNERS_AND_MANAGERS: Only group owners and managers can moderate content.\n" +
312-
" OWNERS_ONLY: Only group owners can moderate content.\n" +
313-
" NONE: No one can moderate content except the group owner (all messages are automatically posted).",
277+
"Specifies who can moderate content.",
314278
);
315279

316280
groupSettingsSheet
317281
.getRange("AE1")
318282
.setNote(
319-
"Specifies who can moderate metadata (tags, topics). Possible values are:\n" +
320-
" ALL_MEMBERS: All group members can moderate metadata.\n" +
321-
" OWNERS_AND_MANAGERS: Only group owners and managers can moderate metadata.\n" +
322-
" MANAGERS_ONLY: Only group managers can moderate metadata (owners cannot).\n" +
323-
" OWNERS_ONLY: Only group owners can moderate metadata.\n" +
324-
" NONE: No one can moderate metadata except the group owner (metadata edits are automatic).",
283+
"Specifies who can moderate metadata.",
325284
);
326285

327286
groupSettingsSheet
328287
.getRange("AF1")
329288
.setNote(
330-
"Specifies whether the group has a custom role that's included in one of the settings being merged. This field is read-only and updates to it are ignored.\n" +
331-
" true: The group has a custom role included in the settings being merged.\n" +
332-
" false: The group does not have a custom role included in the settings being merged.",
289+
"Specifies whether the group has a custom role that's included in one of the settings being merged.",
333290
);
334291

335292
groupSettingsSheet
336293
.getRange("AG1")
337294
.setNote(
338-
"Specifies whether a collaborative inbox will remain turned on for the group. Possible values are:\n" +
339-
" true: The group will continue to use a collaborative inbox where members can see and manage emails sent to the group address.\n" +
340-
" false: The group will not use a collaborative inbox. Emails sent to the group address will only be delivered to group owners.",
295+
"Specifies whether a collaborative inbox will remain turned on for the group.",
341296
);
342297

343298
groupSettingsSheet
344299
.getRange("AH1")
345300
.setNote(
346-
"Default sender for members who can post messages as the group. Possible values are:\n" +
347-
" DEFAULT_SELF: When a member with 'post as group' permission sends a message, it will appear to be sent from their own email address.\n" +
348-
" GROUP: When a member with 'post as group' permission sends a message, it will appear to be sent from the group's email address.",
301+
"Default sender for members who can post messages as the group.",
349302
);
350303

351304
const rangeE = groupSettingsSheet.getRange("E2:E");
@@ -445,7 +398,6 @@ const rule18 = SpreadsheetApp.newConditionalFormatRule()
445398
.setBackground("#c6efce") // Light green
446399
.setRanges([rangeH])
447400
.build();
448-
449401
const rangeI = groupSettingsSheet.getRange("L2:L");
450402
const rule19 = SpreadsheetApp.newConditionalFormatRule()
451403
.whenTextContains("True")
@@ -468,7 +420,6 @@ const rule22 = SpreadsheetApp.newConditionalFormatRule()
468420
.setBackground("#ffc7ce") // Light red
469421
.setRanges([rangeJ])
470422
.build();
471-
472423
const rangeK = groupSettingsSheet.getRange("O2:O");
473424
const rule23 = SpreadsheetApp.newConditionalFormatRule()
474425
.whenTextContains("MODERATE_NONE")
@@ -490,7 +441,6 @@ const rule26 = SpreadsheetApp.newConditionalFormatRule()
490441
.setBackground("#c6efce") // Light green
491442
.setRanges([rangeK])
492443
.build();
493-
494444
const rangeL = groupSettingsSheet.getRange("P2:P");
495445
const rule27 = SpreadsheetApp.newConditionalFormatRule()
496446
.whenTextContains("ALLOW")
@@ -512,7 +462,6 @@ const rule30 = SpreadsheetApp.newConditionalFormatRule()
512462
.setBackground("#c6efce") // Light green
513463
.setRanges([rangeL])
514464
.build();
515-
516465
const rangeAM = groupSettingsSheet.getRange("I2:I");
517466
const rule31 = SpreadsheetApp.newConditionalFormatRule()
518467
.whenTextContains("ANYONE_CAN_DISCOVER")
@@ -521,7 +470,7 @@ const rule31 = SpreadsheetApp.newConditionalFormatRule()
521470
.build();
522471
const rule32 = SpreadsheetApp.newConditionalFormatRule()
523472
.whenTextContains("ALL_IN_DOMAIN_CAN_DISCOVER")
524-
.setBackground("#c6efce") // Light green
473+
.setBackground("#ffc7ce") // Light red
525474
.setRanges([rangeAM])
526475
.build();
527476
const rule33 = SpreadsheetApp.newConditionalFormatRule()
@@ -552,6 +501,26 @@ const rules = [
552501

553502
groupSettingsSheet.setConditionalFormatRules(rules);
554503

504+
// Add filters to columns E-AH
505+
const lastColumn = groupSettingsSheet.getLastColumn();
506+
const filterRange = groupSettingsSheet.getRange(1, 5, 1, Math.min(31, lastColumn - 4)); // Filters E to AH
507+
let filter = groupSettingsSheet.getFilter();
508+
if (filter) {
509+
filter.remove();
510+
}
511+
let criteria = SpreadsheetApp.newFilterCriteria().build();
512+
let dataRange = groupSettingsSheet.getDataRange();
513+
let filterCreated = dataRange.createFilter();
514+
for (let i = 5; i <= Math.min(34, lastColumn); i++) {
515+
filterCreated.setColumnFilterCriteria(i, criteria);
516+
}
517+
518+
// Auto resize specified columns
519+
const columnsToResize = [5, 6, 7, 8, 9, 15, 17, 25, 26, 28, 29, 30, 31, 34]; // E, F, G, H, I, O, Q, Y, Z, AB, AC, AD, AE, AH
520+
columnsToResize.forEach(column => {
521+
groupSettingsSheet.autoResizeColumn(column);
522+
});
523+
555524

556525
let pageToken;
557526

0 commit comments

Comments
 (0)