Issue with Excel column values read

David M. wrote in post #1096585:

Wowwww… Really nice, I never have thought about the things,you pointed
out here. Definitely I will give it a try.

Use the Text property of a cell, rather than the Value property.

For example, change…

wbs.cells(rows,8).value

…to…

wbs.cells(rows,8).Text

The Value property returns the underlying value as stored by Excel (for
numbers this is a decimal).

The Text property returns the value as it is displayed.

David

Ruby on Windows: excel

Love U Ruby wrote in post #1096307:

When my code is trying to read the values only the bad data is coming
from the values like 5,10… They are being converted to 10.0,5.0. Which
causes my code to fail,as in the select list no such values like 10.0 or
5.0. I tried to fix it by formatting the Excel column as “Text”,but
doesn’t work.

CODE:

if wbs.cells(rows,8).value != nil

elem = driver.find_element(:name, “defaultAnswerId”)
option = Selenium::WebDriver::Support::Select.new(elem)
puts wbs.cells(rows,8).value
default_val = wbs.cells(rows,8).value.strip
option.select_by(:text, default_val)

end

any idea how to fix that.

Use the Text property of a cell, rather than the Value property.

For example, change…

wbs.cells(rows,8).value

…to…

wbs.cells(rows,8).Text

The Value property returns the underlying value as stored by Excel (for
numbers this is a decimal).

The Text property returns the value as it is displayed.

David