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.

Read xls file created by self

chaudharypareshchaudharyparesh Members
edited March 2011 in Sahi - Open Source
I want to read xls file but in that i want to more understanding

First i am create on xls file name is (Test.xls)

My xls file like this in excel shit

Name Age Sex
Raju 20 Male
Ramu 30 Male
Sheela 25 Female


After than i have write one script with .sah extension in that add two syntax
var db1 = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=Test.xls;readOnly=false", "", ""); ---> it execute success
$rs = db1.select("select * from [Sheet1$]"); --> it's fail

in second line what i have to write instead of Sheet1$ that i do not know , i think it's database name
but i have created xls by self ,

So What i have to write instead of Sheet1$


Thanks Advance

Comments

  • Any Idea
  • Its failed means what kind of error are you getting ??

    Here you instead of [Sheet1$] you need to give sheet name on which you have put this data. By default all xls file having naming like [Sheet1$],[Sheet2$].....and onwards.

    Apart from this syntex you need to do some data base set up also ...from control pannel > Admin tools > ...and all....

    So failure can be cause of any of this two reason.....specify error you are getting so either i or someone else can help...
  • narayannarayan Administrators
    Hi Paresh,

    Check if there are any errors on the Sahi console. If yes, post them here. Give the full correct path to the xls file (Eg. C:\\mydata\\Test.xls) instead of Test.xls

    Make sure that the xls file is stored in Excel 97-2003 format.

    Akash, you do not need to configure Excel as a Data source anymore.

    Regards,
    Narayan
  • Thanx for Update Narayan,

    I was using this functionality with Sahi's older version right now i had replaced it with dynamic CSV files instead of updating xls sheet every time.

    Sorry for outdated update or solution from my side buddy.....hope you won't mind....... :)
Sign In or Register to comment.