Tuesday, January 17, 2012

Reading Excel using EPPlus


      ExcelPackage excelPackage;
       ExcelWorkbook myWorkbook;
       string SheetName = "Demo";
       string cell = "";
       string tmpFileName = "log";

       string main_ref_no = "";
       string tempDktNo = "";

       ImportProcess objImportProcess = new ImportProcess();
FileInfo existingFile = new FileInfo(@"D:\\Sample\DemoFile.xlsx");

using (excelPackage = new ExcelPackage(existingFile))
           {
                           
              myWorkbook = excelPackage.Workbook;
if (myWorkbook.Worksheets[SheetName].Cells[cell].Value != null)
             {
string var = myWorkbook.Worksheets[SheetName].Cells[ColumnID[ColNo] + "1"].Value.ToString();

string var1 = myWorkbook.Worksheets[SheetName].Cells["C" + RowNo].Value.ToString();
//string var = myWorkbook.Worksheets[SheetName].Cells["A1"].Value.ToString();
}
}

//string.Format("{0:000000}",123);






No comments:

Post a Comment