How to Get the currently selected cell/range?
28,884
This custom function will get the selection at the time you update the cell with the function. But it will not update as the selection changes.
Henrique provides a good explanation of why custom functions like this don't update in Google Apps - script to summarise data not updating.
/**
* A function that gets the current selection, in A1Notation.
*
* @customfunction
*/
function SELECTED_RANGE() {
return SpreadsheetApp.getActive().getActiveRange().getA1Notation();
}
Author by
febot
I am. (See my LinkedIn profile. Open to job offers for USA, Germany, Austria, Switzerland). 2012 update: I'm a company-man, a team-player, a paradigm-shifter and a core-competancy-synergizer. :) PS: I worked for Red Hat / JBoss, so my answers may be biased. Currently work for Swiss Re.
Updated on July 09, 2022Comments
-
febot almost 2 years
Is there a way to get the identification (i.e. A1 notation) of a selected cell or range in Google Sheets?
Something like:
=SELECTION(['Sheet1']) -> "D6"