Display results as :
Advanced Search

Go down
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

on 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;

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