[Solved] Transpose N rows to one column in Google Sheets – Script Editor


function rowstocolumn() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet2');
  const osh = ss.getSheetByName('Sheet3');
  const vs = sh.getRange(2,1,sh.getLastRow()-1,sh.getLastColumn()).getValues();
  let col = [];
  vs.forEach(r => {
    r.forEach(c => col.push([c]))
  });
  osh.clearContents();
  osh.getRange(1,1,col.length,col[0].length).setValues(col);
}

2

solved Transpose N rows to one column in Google Sheets – Script Editor