Accessing the Cell Coordinates in custom function

custom-function, google-apps-script, google-sheets

Solution

Spreadsheet custom functions arguments contain only values pointed as arguments and not cell addresses. This fact not clear documented but there are a couple of similar questions here, for instance, this one. There is a workaround by using the build-in function ADDRESS. like in the following code

=myFunc(ADDRESS(ROW(F8), COLUMN(F8)))

Problem

Is there a way to access the cell coordinates (in A1 notation) of the cell that was passed in to my function? For example, if my function is this ``` function displayA1Notation(myCell){ return myCell.getA1Notation(); } ``` and I put the following in cell B4: ``` =displayA1Notation(C6) ``` I'm hoping to see this: ``` C6 ``` But what I actually see is this: ``` Kansas ``` ("Kansas" is the actual cell value of C6) I know this seems easy... I'm just stuck in trying to get it to work. Thanks~!

Original source

Related problems