1D Array to fill a spreadsheet column

前端 未结 2 1189
甜味超标
甜味超标 2021-01-07 15:31

I\'m using the built-in group service to pull a list of usernames...

function getUsersInGroup(group) {
  var usersInGroup = GroupsApp.getGroupByEmail(group).         


        
2条回答
  •  日久生厌
    2021-01-07 16:04

    As @TheMaster pointed out, a simple loop with the map function worked well. Here's what I did:

    function writeArrayToColumn(array) {
      var mainSheet = SpreadsheetApp.getActiveSheet(); 
    
      var newArray = array.map(function (el) {
        return [el];
      });
    
      var range = mainSheet.getRange(2, 1, newArray.length, 1);
    
      range.setValues(newArray);
    }
    

提交回复
热议问题