I\'m using the built-in group service to pull a list of usernames...
function getUsersInGroup(group) {
var usersInGroup = GroupsApp.getGroupByEmail(group).
You can also use the sheets API, If you don't want to loop through.
Use Advanced Google services and switching majorDimension as columns:
var data = [ 'person1@email.com', 'person2@email.com', 'person3@email.com' ];
var request = {
range: 'Sheet1!A1',
majorDimension: 'COLUMNS',
values: [data], //still 2D
};
//API must be enabled before use.
//https://developers.google.com/apps-script/advanced/sheets
Sheets.Spreadsheets.Values.update(request, ss.getId(), request.range, {
valueInputOption: 'USER_ENTERED',
});
Or loop through:
data = data.map(function(e){return [e];});