We can use .getA1Notation() to get Notation of a cell Range, for example D3 Could you guys please advise any idea of how to get absolute Notation for a Range, for example $D$3 ?
Thanks in advance,
We can use .getA1Notation() to get Notation of a cell Range, for example D3 Could you guys please advise any idea of how to get absolute Notation for a Range, for example $D$3 ?
Thanks in advance,
Unfortunately, in the current stage, it seems that getA1Notation() cannot directly return the a1Notation like $D$3. So, in your situation, how about the following sample script?
const sheet = SpreadsheetApp.getActiveSheet();
const a1Notation1a = sheet.getRange(3, 4).getA1Notation();
const a1Notation1b = sheet.getRange(3, 4).getA1Notation().replace(/([A-Z]+)/g, "$$$1$$");
console.log(a1Notation1a) // D3
console.log(a1Notation1b) // $D$3
const a1Notation2a = sheet.getRange(1, 1, 2, 2).getA1Notation();
const a1Notation2b = sheet.getRange(1, 1, 2, 2).getA1Notation().replace(/([A-Z]+)/g, "$$$1$$");
console.log(a1Notation2a) // A1:B2
console.log(a1Notation2b) // $A$1:$B$2