This should be a simple one, but I could not crack it myself... I want to copy the currently selected cells in the active sheet in an array called data:
var sheet = SpreadsheetApp.getActive().getActiveSheet();
var selection = sheet.getActiveRange();
var data = selection.getValues();
The above results in the array getting the content of cell A1, no matter which cells are actually selected. When I replace getActiveRange()
with e.g. getRange(2,1,10,10)
that works as expected.
Any clue as to why I cannot get to the currently selected cells is appreciated!