Retrieve an excel object by value as a database connecton

This could be a technical limitation or I just can’t figure out the magic but what I am attempting to do is retrieve a value from table using a variable or “container” as the calling object. Let me explain in code.

Table:
Team 1 | Team 2
Team Name | Team Name

Code

Put ExcelProcessorUtil.ImportExcelWorksheet(“TeamList.xls”,“Teams”) into data
Repeat for each record in data
put “Team” && Counter() into member

log the first word of record.member
log the second word of record.member
End Repeat

What I am trying to figure out is if there is a way to do this? If I provide the string for the column header record.“Team 1” it works but the results is empty when I give it a reference to the string record.member. Please tell me there is a way to do this so I don’t have to duplicate a bunch of code.

This might be simpler:

set global myConnectionString to (type:“excel”, file:ResourcePath(“DERMSI-1.xlsx”), writable: Yes) – set the specified variable, myConnectionString, to store the connection to the referenced Excel file
set global myImages to table “Images” of global myConnectionString – declare worksheet using worksheet name

put the number of records of global myConnectionString into global RecordCount

Then I call each item of each record by the field name in row 1 of the Excel: (note the dot that separates the variable name and the field name)
//RecNumber is a 1…EOF counter stored in a column in Excel
//global RecordCount is a value that I iterate
set global CurrentImage to the record of global myConnectionString where RecNumber is global RecordCountCounter
Click “LastName”
TypeText global CurrentImage.LastName
Click “FirstName”
TypeText global CurrentImage.FirstName
Click “MiddleName”
TypeText global currentImage.MiddleName

Hope this helps.