18 January 2026:


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.

Excel update _getDB

chejnesschejness Members
edited November -1 in Sahi - Open Source
Hi Team,

I am still stuck with the connect to database problem!
I tried the same with the excel sheet too.
None of the options working for me.
Checked the post:
http://sahi.co.in/forums/viewtopic.php?id=1075
Made the necessary changes.
Still it doesn't seem to work!
May be I have missed out something very crucial there.
Can you please check and let me know the fix?


The script is:
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\\scripts\\testSheet.xls;readOnly=false", "", "");
_alert("db end");
db.update("update [Sheet1$] set Age=21 where Name='Aby'");
_alert("db update end");
var $rs = db.select("select * from [Sheet1$]");
_assertEqual('Aby', $rs[0]["Name"]);

This is not updating the excel sheet!!

Please let me know how to resolve this problem.

Comments

  • Hi,

    I just checked the example given in
    http://sahi.co.in/w/working-with-excel-sheets
    and it works absolutely fine for me. I used the latest build (V3).
    The config I used is Windows Vista, FF3

    I would suggest you to use the same example code and then work backwards to make it fit to your need.

    Regards,
    Pankaj
  • I have a Report.xls file which has the below data:

    S.No Scenario Result
    1 abc Pass


    Below is my code:

    var db =_getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\\Projects\\In progress\\Sahi\\Installation\\userdata\\scripts\\ILS_Report.xls;readOnly=false", "", "");
    $rs = db.select("select * from [Sheet1$]");
    _assertEqual("1", $rs[0]["S.No"]);

    During playback, "Statements" box of Sahi displays: _assertEqual("1", null);

    I do not know, why it displays the value of $rs[0]["S.No"] as null. Any help?
  • Hi lawrence,

    The Report.xls file should be:

    SNo Scenario Result
    1 abc Pass

    Check if this solves your issue.

    Regards
    Sumita
  • Hi Sumitra,
    Thanks and it works
This discussion has been closed.