How to call from a stored excel row and return just the value without the co-ordinates?

Viewed 75

I'm currently using RIDE - ROBOT-Framework, I have an excel file with test data & I need to input one of the values stored in a variable using "Get Row Values". I'm able to do it, but the problem is that it returns the field co-ordinates in front of the value. Any advice on how to remove the two character field co-ordinates value from the output?

Open Excel  text.xls
@{Datas}=   Get Row Values  Sheet1  2
Input Text  username    ${Datas[1]}

Input Text | username | ${Datas[1]}

Actual Results: The results from the above code puts the text in a text box called username correctly, but it is adding the excel coordinate code at the beginning, so it currently looks like this: B3Johnson

Expected results: I want the inputted text to have just the value: Johnson

So I need help on the most efficient way to call it correctly or remove the co-ordinates B3. I don't want to trim by a certain amount of characters as if I'm pulling from a row that is B23 for example, it would be 3 characters instead of 2. So I just need the value of the field alone and not the co-ordinate identifier to display.

The reason I need to call a row value is that I may need the other values stored in the {Datas} variable to input into other text fields like first name - so the row has associated data. Otherwise I would just get the cell value.

1 Answers

The value returned by Get Row Values is a two-dimensional object - a list of tuples; this means the data looks like this:

[("A1", "value cell 1"), ("A2", "value cell 2"), ]   # and so on, the rest of the cells

Thus to get just the cell value, you need two indices - which sub-list, and what member to get from it:

Log To Console    ${Datas[0][1]}
# the first sub-list ("column" in the excel), and its second member - the value
Related