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?
Asked
Active
Viewed 67 times
-1
-
1Please show what you tried and add a brief description of your search efforts as is suggested in [ask] – Rubén Jun 15 '21 at 00:56
-
1https://stackoverflow.com/a/63860734/14265469 – Yuri Khristich Jun 15 '21 at 08:57
1 Answers
-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
-
Cooper, please, fix typos. Otherwise it won't work and it will confuse beginners. – Yuri Khristich Jun 15 '21 at 09:04