Skip to content

Instantly share code, notes, and snippets.

@pen
Created February 20, 2015 03:26
Show Gist options
  • Save pen/430c1e74878c1870b3aa to your computer and use it in GitHub Desktop.
Save pen/430c1e74878c1870b3aa to your computer and use it in GitHub Desktop.
Google App で自分が参加しているグループをGoogleスプレッドシートにとりだすGoogle App Script
/*
* @OnlyCurrentDoc
*/
function myFunction() {
var names = GroupsApp.getGroups()
.map(function(g) { return g.getEmail().replace(/@.*/, "") })
.sort();
SpreadsheetApp.getActiveSheet()
.clearContents()
.getRange(1, 1, names.length, 1)
.setValues(names.map(function(n) { return [ n ] }));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment