This project is read-only.
2
Vote

Its observed that, whenever data given in the first cell, its not recognizing data from second cell too

description

• We are using dll called 'Excel.dll(2.0.1.0)' (Specifically excelReader.AsDataSet()) method to read the data from .xlsx file. • Its observed that, whenever data is not given in the first cell, its not recognizing data from second cell too.• In the attached file, first cell of second row doesn't contain any value hence dll is not reading data given data (i.e Choice).• So, please ananlyze this issue and provide the needful resolution.

file attachments

comments

evalenzuela wrote Dec 6, 2012 at 6:14 PM

Hello,
i could detect the same issue, even if the empty cell is the first one or in the middle,

if a cell is empty ( C1 ), the next cell (D1) returns empty too...
and the next cells ( E1, F1, G1... ) already returns the excel value correctly

i am using next code:


FileStream stream = File.Open(MapPath("~/zAttachments/" + sFileName), FileMode.Open, FileAccess.Read);

//Step-1: Include the connection string for the EXCEL file containing the filename and Provider settings
if (sExt.ToLower() == "xls")
{
//1. Reading from a binary Excel file ('97-2003 format; *.xls)
excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
}
else if (sExt.ToLower() == "xlsx")
{
//2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}


//3. DataSet - The result of each spreadsheet will be created in the result.Tables
//4. DataSet - Create column names from first row
excelReader.IsFirstRowAsColumnNames = true;
dtResult = excelReader.AsDataSet().Tables[0];

for(int iRow = 0; iRow < dtResult.Rows.Count; iRow++)
{
  sCellInfo= dtResult.Rows[iRow][0].ToString().Trim().ToUpper();
}


tell me if there is a solution about it...

thanks

wrote Dec 6, 2012 at 6:15 PM

wrote Dec 12, 2012 at 4:12 PM

wrote Feb 22, 2013 at 1:47 AM

wrote Nov 28, 2017 at 4:48 AM