I am trying to read a sheet data from excel (tried both oldedb and odbc) and found out that there is 255 characters limit.
I tried using Range
object as suggested
below code work for me. import data from excel (.xls & .xlsx) file (work for column value more than 255 character).
using Excel;
try
{
FileStream stream = File.Open(strFilePath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = null;
if (extension.Trim() == ".xls")
{
excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
}
else if (extension.Trim() == ".xlsx")
{
excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}
excelReader.IsFirstRowAsColumnNames = true;
DataSet result = excelReader.AsDataSet();
excelReader.Close();
}
catch (Exception err)
{
mResult.Message = err.Message;
}
Download nuget packages: 1) PCLStorage (Version: 1.0.2) 2) ExcelDataReader-DevNet45 (version: 1.0.0.2)
Code reference