18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Unable to read an integer valus from Excel sheets
Hi All,
I am new to this tools and was having following issues, please help me to go through.
Here are the details,
Excel file name = DataSummary.xls.
Location =
Xls file contained following column with integer values
Value
12
sample code
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\\DataSummary.xls;readOnly=false",
"",
"");
$rs = db.select("select * from [Sheet1$]");
_assertEqual("12", $rs[0]["Value"]); //Following line got fail since system display "$rs[0]["Value"]" as "null".
_assertEqual(12, parseInt($rs[0]["Value"])); //Following line got fail since system display "$rs[0]["Value"]" as "NaN".
I am new to this tools and was having following issues, please help me to go through.
Here are the details,
Excel file name = DataSummary.xls.
Location =
Xls file contained following column with integer values
Value
12
sample code
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\\DataSummary.xls;readOnly=false",
"",
"");
$rs = db.select("select * from [Sheet1$]");
_assertEqual("12", $rs[0]["Value"]); //Following line got fail since system display "$rs[0]["Value"]" as "null".
_assertEqual(12, parseInt($rs[0]["Value"])); //Following line got fail since system display "$rs[0]["Value"]" as "NaN".
This discussion has been closed.
Comments
1. Right click on cell which contain integer value
2. Select format cell
3. Select category as text and OK.
Now below code should get pass
_assertEqual(12, ($rs[0]["Value"]));
Please check if the path to your xls file is correct. Also, check if the data is available in the right sheet. In this case, the sheet being selected is "Sheet1".
Once this is done, the following script should work with your excel file
DataSummary.xls
Sahi script:
Regards
Sumitra
Dev has already mentioned that he has found the solution. Closing this.
Regards,
Narayan