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.

Is it possible to compare values in an excel file with csv file?

Sudheer PSudheer P Members
edited August 2011 in Sahi - Open Source
HI All,

I have data in a spreadsheet which have energy readings of all the buildings, i need to compare the values of a particular building downloaded through the web application which is in a csv format with the values existing in spreadsheet of that particular building.

Thanks in Advance
Sudheer

Comments

  • Hi Sudheer P,

    Yes, you can compare values in an excel file with CSV file.

    Here is an example which would help you.

    The Excel file contains:

    Name Age Sex
    Raju 50 Male

    The CSV file contains:

    Name Age Sex
    Raju 25 Male

    To compare Raju from Excel file with CSV file the following code works:
    var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=D:\\trial.xlsx;readOnly=false","","");
    $rs = db.select("select * from [Sheet1$]");
    _assertEqual("Raju", $rs[0]["Name"]);
    var $name = $rs[0]["Name"];
    var $data = _readCSVFile("C:\\Documents and Settings\\Sumitra\\sahi-pro-v36\\userdata\\temp\\download\\text.csv");
    _assertEqual($name,$data[1][0]);
    

    Regards
    Sumitra
Sign In or Register to comment.