Pretty self-explanatory, but given 2D array indices (as CSV), how do I convert it to a spreadsheet cell coordinates? For example, "0, 0" would output "A1", "3, 4" would be "D5", etc.
Convert 2D array indices to spreadsheet cell co-ordinates in JavaScript
46 views Asked by darkhorse At
2
There are 2 answers
0
On
SUGGESTION:
Try this:
function myFunction() {
var sample = [[0,0],[3,4]]; //your sample 2d array
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
sample.forEach(x => console.log(sheet.getRange(x[1] + 1, x[0] +1).getA1Notation()) )
}
Log results:
Reference:
https://developers.google.com/apps-script/reference/spreadsheet/range#geta1notation

Split and convert strings to number and use
String.fromCodePoint:For >=26, see Convert column index into corresponding column letter