-1

How to extract a column of a 2-dim array in GAS? I thought I can do that if I transpose a 2-dim array, but is there an easy way of transposing a 2-dim array in GAS?

andrewJames
  • 19,570
  • 8
  • 19
  • 51
cat
  • 15
  • 1

1 Answers1

-1
function getColumnTwo() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheetname');
const vs = sh.getDataRange().getValues();
const col2Values = vs.map(r => r[1]).flat();
Cooper
  • 59,616
  • 6
  • 23
  • 54