Get all selected cells in google script

I use the following code to get the selected cells:

var activeRange = SpreadsheetApp.getActiveRange().getA1Notation(); 

If I select cells B1, B2, B3, it returns "B1: B3". But if I select B1, and then use the Ctrl key to also select B3, it will only return to β€œB3”. I want "B1, B3". I could not find a function for this in the documentation.

+5
source share
1 answer

Script applications do not currently provide support for handling disjoint ranges within Range objects. What will happen is that the last subband selected will be returned by calls to getActiveRange (), etc. It is registered here as issue 4069 . You may want to β€œignite” it.

+5
source

Source: https://habr.com/ru/post/1209420/


All Articles