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.
Getting Error When I am Working with Excel Sheets
Hi,
I am very new to Sahi and exploring the tool and same time i am using Datadriven using Excel sheet and as per Tutorial i wrote lines of code but still i am not getting values from excel instead i am getting below error please help me out soon..
var ExObj = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver = {Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};
DBQ =
\\Sahi Practice\\InputData\\SampleData.xls;readOnly = false", "", "");
ERROR [110 ms]
unterminated string literal
Please let me know where i went wrong and solution for that...
Thanks in Advance,
Regards,
Sandeep S S
I am very new to Sahi and exploring the tool and same time i am using Datadriven using Excel sheet and as per Tutorial i wrote lines of code but still i am not getting values from excel instead i am getting below error please help me out soon..
var ExObj = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver = {Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};
DBQ =
ERROR [110 ms]
unterminated string literal
Please let me know where i went wrong and solution for that...
Thanks in Advance,
Regards,
Sandeep S S
This discussion has been closed.
Comments
Kindly have a look at http://sahi.co.in/forums/viewtopic.php?id=1599 .
If you are using an old version of Sahi, could you please try with the latest version and check.
Check if you are getting any error on Sahi console? If so then please post it here.
Regards
Sumitra
Thanks for your reply.
Here i am using Sahi 4.0 pro newer version but still also i m getting the error as mentioned above..
please find the my code below..
var ExObj = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver = {Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};
DBQ =
$strGetVal = ExObj.select("select* from [Sheet1$]");
_assertEqual("10",parseInt($strGetVal[0]["First Number"]));
_assertEqual("20",parseInt($strGetVal[1]["Second Number"]));
_assertEqual("Add",$strGetVal[2]["Action"]);
_assertEqual("30",parseInt($strGetVal[3]["Total"]));
Error Which i got is
Starting script
ERROR [110 ms]
unterminated string literal
Stopping script
please help me out..
Regards,
Sndeep S S
Kindly make sure that the below line in the script is in a single line.
Also, the other part of code should be:
Check if this solves your issue.
Regards
Sumitra
the code is in singale line and now This time i got below error ..
exception: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source) at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:100) 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)
Regards,
Sandeep S S
Kindly have a look at :
http://sahi.co.in/forums/viewtopic.php?id=3159
http://sahi.co.in/forums/viewtopic.php?id=1840
Regards
Sumitra
I have done the Changes as per above links and its working fine now... Thanks a lot..
can you please let me know is what is the method to count the number of rows in Excel sheet i used below menthod but i m getting error as
Method
var $sRowCount = ExObj.select("select count(*) from [Sheet1$]");
Error
"recursive_access"
Please let me know the method..
Thanks in Advance.
Regards,
Sandeep S S
Could you try using this:
var $sRowCount = "" + $ExObj.select("select count(*) from [Sheet1$]");
Check if this solves your issue.
Regards
Sumitra
Thanks a ton for your support that line of code works for me...
only some change i did is..
var $sRowCount = "" + $ExObj.select("select count(*) from [Sheet1$]");
it should be like
var $sRowCount = "" + ExObj.select("select count(*) from [Sheet1$]");
Really Hats off to you and your team.....
Regards,
Sandeep S S