Convert row and column data to column-only

前端 未结 3 1295
离开以前
离开以前 2021-01-27 13:38

I\'m completely new to Google Script so bear with me. I\'m attempting to write a script that will take data from several rows and columns and then rewrite it into a single colum

3条回答
  •  时光取名叫无心
    2021-01-27 13:41

    This seems to work. Manually iterates through the array and sets it with a for loop.

     function copyRow() {
      var ss = SpreadsheetApp.getActive();
      var sheet = ss.getActiveSheet();
    
      var numRows = sheet.getLastRow();
      var rowIdx = sheet.getActiveRange().getRowIndex();
      var colIdx = sheet.getActiveRange().getColumnIndex();
    
      var theValues = sheet.getRange(rowIdx,colIdx,sheet.getLastRow(),3).getValues();
    
      theValues = theValues.toString().split(",");//convert 2D array to 1D
    
      var outerArray = [];
    
      for(var i=0; i

提交回复
热议问题