Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
Auto_mate
Posts : 1
Join date : 2014-04-09

reading from an excel report -appreciate any urgent response Empty reading from an excel report -appreciate any urgent response

Wed Apr 09, 2014 11:39 am
I recorded the code using selenium ide. Then the html was converted to C#/NUnit/Selenium IDE

the converted code i'm modifying to read data from an excel work book  called - Parametrization.xlsx

I inserted the code below to my code. But I'm having a difficulty identifying how to pass values to this piece of code,
string Value = (string)((Excel.Range)configurexlobj.Cells[rowconfigxl, 5]).Text;

appreciate if you could answer my below queries,

1) is the way I have done so far correct?
2) I need to pass a value in the 99th row column A- how can I do that using above code?  (its also a string)

    //Creating an xls object
    public static Excel.Workbook ExcelSetupProcess(string path)
    {
        Excel.Application excelApp;
       
        excelApp= new Excel.Application();
        Excel.Workbook Parametarization;
        Parametarization = excelApp.Workbooks.Open(path, 0, false, 5, "",        "",true,Excel.XlPlatform.xlWindows,"\t", true, false, 0,true, true, false);
        return Parametarization;
    }

    //Reading xls sheet
    public static void ProcessXLSFile(string fileName)
    {


    //private string ExcelSetupProcess;

    Excel.Parametarization workBookConfig = ExcelSetupProcess(fileName); // retuns the filename

    //Reading the xls workbook
    Excel.Worksheet configurexlobj = (Excel.Worksheet)workBookConfig .Sheets["PARAMETARIZATION"];

    //Process row by row
    int rowcntconfigxl = configurexlobj.UsedRange.Rows.Count;
    for (int rowconfigxl = 2; rowconfigxl <= rowcntconfigxl; rowconfigxl++)
        {
        //Here you have to write your code. I just given an example of below statement.
        string Value = (string)((Excel.Range)configurexlobj.Cells[rowconfigxl, 5]).Text;
        }
    }

Thanks
Back to top
Permissions in this forum:
You cannot reply to topics in this forum