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.

Some Cells are not readable in excel file

shahparthshahparth Members
edited January 2012 in Sahi - Open Source
Dear All,

I have one requirement in which, I am reading cells from the excel file.

Format of each cell is - Text.

I have 3 columns in excel file.

Example:

A B C

some some some
text+number text+number+ text+number+
+special symbol special symbol(!,@etc.) special symbol.
.
.
.
.
total 100 Rows


So, When I tried to read the particular cell, it creates problem like only some of the text able to read from that cell and rest text won't comes.

Can Somebody help me.

I send my excel file + code to support@sahi.co.in from my parth_ec447@yahoo.co.in mail id.


code is mentioned below.

var $Username = "parth";
var $Password = "parth10";

var $ModuleName = "wireless";
var $SubModuleName = "wireless";

var $DB_FileValue;
var $Total_Rows = 100;

function ReadExcelFile()
{
    var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Documents and Settings\\parth.shah\\Desktop\\1.xls;readOnly=true", "", "");

    $DB_FileValue = db.select("select * from [Sheet1$]");
}

function Login($username,$password)
{
    _setValue(_textbox("username"), $Username);
    _setValue(_password("password"), $Password);
    _click(_submit("Login"));
    _click(_image("managetc.png"));
    _setSelected(_select("moduleid"), $ModuleName);
    _setSelected(_select("macrotestcaseid"), $SubModuleName);
}

function ProcessExcelFile()
{
    var $i=0;

    for($i=0;$i<$Total_Rows;$i++)
    {
        _setSelected(_select("moduleid"), $ModuleName);
        _setSelected(_select("macrotestcaseid"), $SubModuleName);

        _setValue(_textbox("desc"),$DB_FileValue[$i][0]);    // this creates problem,some text missing
        _setValue(_textarea("inputvalue"),$DB_FileValue[$i][1]);  //this creates problem, some text missing
        _setValue(_textarea("expoutput"),$DB_FileValue[$i][2]);   //this creates probem, some text missing

        if($DB_FileValue[$i][3] != "null")
        {
            _setValue(_textarea("testdata"),$DB_FileValue[$i][3]);
        }

        if($DB_FileValue[$i][4] != "null")
        {
            _setValue(_textarea("debuginfo"),$DB_FileValue[$i][4]);
        }

        if($DB_FileValue[$i][5] != "null")
        {
            _setSelected(_select("smoketest"), $DB_FileValue[$i][5]);
        }

        _click(_submit("Add TestCase"));
    }
}

ReadExcelFile();
Login($Username,$Password);
ProcessExcelFile();



Please help me out in this scenario.

Comments

Sign In or Register to comment.