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.
fetching value from two sheets of same excel at iterations
hi,
im facing problem in fetching value from two different sheets of same excel in different iterations , my script is like below,
var $db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\Users\\shreedhar.athani\\sahi_pro\\userdata\\scripts\\data_for_fetchvalue_by_2_sheets.xls;readOnly=false", "", "");
for(var $i=1;$i<4;$i++)
{
var $tc="Sheet"+$i+"$";
_alert($tc);
$rs = $db.select("select * from [$tc]");
//$rs = $db.select("select * from [testcase1$]");
for(var $x=0;$x<$rs.length;$x++)
{
_alert($x);
var $un = $rs[$x]["UN"];
var $pwd = $rs[$x]["PWD"];
and
i mgetting this error on console
Starting script
ERROR [110 ms]
exception: java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object '$tc$'. Make sure the object exists and that you spell its name and the path name correctly. at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source) at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source) at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:105) at net.sf.sahi.plugin.DBClient.select(DBClient.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175) at org.mozilla.javascript.Context.evaluateString(Context.java:1104) at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:144) at java.lang.Thread.run(Unknown Source)
please help me inthis regard.
thank you in advance,
Shreedhar.athani
im facing problem in fetching value from two different sheets of same excel in different iterations , my script is like below,
var $db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\Users\\shreedhar.athani\\sahi_pro\\userdata\\scripts\\data_for_fetchvalue_by_2_sheets.xls;readOnly=false", "", "");
for(var $i=1;$i<4;$i++)
{
var $tc="Sheet"+$i+"$";
_alert($tc);
$rs = $db.select("select * from [$tc]");
//$rs = $db.select("select * from [testcase1$]");
for(var $x=0;$x<$rs.length;$x++)
{
_alert($x);
var $un = $rs[$x]["UN"];
var $pwd = $rs[$x]["PWD"];
and
i mgetting this error on console
Starting script
ERROR [110 ms]
exception: java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object '$tc$'. Make sure the object exists and that you spell its name and the path name correctly. at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source) at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source) at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:105) at net.sf.sahi.plugin.DBClient.select(DBClient.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065) at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175) at org.mozilla.javascript.Context.evaluateString(Context.java:1104) at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:144) at java.lang.Thread.run(Unknown Source)
please help me inthis regard.
thank you in advance,
Shreedhar.athani