JavaScript for Apple Numbers - I'm trying to use the row.address of a selected range to step through a for{} loop, but the values returned aren't compatible integers (if that makes sense). A spreadsheet is open, and several rows are selected when the script runs.
var firstRow = cells[0].row.address;
var lastRow = cells[cells.length-1].row.address;
// these values seem valid, and can be inserted into the spreadsheet
cells[0].value = firstRow;
cells[1].value = lastRow;
for (i=firstRow; i<lastRow; i++) {
// this generates an error that terminates the script:
// The action "Run JavaScript" encountered
// an error: "Error: Error: Can't convert types."
cells[2].value = i; // this line never runs
}
If I use math on firstRow or lastRow, I get the same error (e.g., var j = lastRow+1
), so it's like the 'integer' value isn't really an integer value. How do I reference these values as integers, or at least so as to not get the error?
Thanks.