More AppleScript with Numbers - simple cell referencing
I am trying to build references to a series of cells in a table. Here is a simple example - the table is Politicians with some number of records. I need a script to reference the contents of a series of cells in a single row.
Here, there is a pointer cell called Cursor. Cursor contains the address of the first cell of reference, in this instance B3, which is the ID of Abraham Lincoln's record. From here, I wish to build cell reference for the next 3 columns after ID, to get that record's Name, Position and City. So there are some levels of indirection necessary.
set cursorPtr to "A2" --Pointer to current record
-Get cell addresses of current record
set cellID to value of cell cursorPtr --should be "B3"
--Here seems I need to use row and column identifiers/constructs but I'm stuck manipulating them
set cellName to value of cell X --need to construct X = "B3" + 1 column = "C3"
set cellPosition to value of cell Y --Y = "B3" + 2 columns = "D3"
set cellCity to value of cell Z --Z = "B3" + 3 columns = "E3"
set recordID to value of cell cellID --(B3) should be 895
set recordName to value of cell cellName --(C3) should be "Abraham Lincoln"
set recordPosition to value of cell cellPosition --(D3) should be "Senator"
set recordCity to value of cell cellCity --(E3) should be "Springfield IL"
I tried:
set recordRow to row of (cell cellID) --cellID = "B3"
--would need similar for column
and got:
error "Numbers got an error: Can’t get cell \"B3\"." number -1728 from cell "B3"
How do I get integers for cell references to work with and increment the columns, to reconstruct additional cell references?
MacBook Pro (2017 – 2020)