Raja

Raja

  • 551
  • 2k
  • 346.7k

How to read particular excel document rows & columns in c#?

Nov 28 2016 1:24 AM
I have upload one excel file with the multiple sheets.And convert the excel document to data table and validate the data table.many validation process in this case.in this excel have many heading like item number,manufacturer number ... i have validate if any empty cell in mandatory field to store the error message in one table and the finally i will show the error table and correct the cells against the heading.Now the problem is i convert the excel to data table some excel files have more rows and columns(65536,1048576 actual excel row) on that time (Exception of type 'System.OutOfMemoryException' was thrown.) exception is thrown.how to fix the particular row column of the excel document.
 
 
 
What I have tried:


FileStream stream = File.Open(SourceUpload.Fullpath, FileMode.Open, FileAccess.Read); 
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
ds = excelReader.AsDataSet();
 

Answers (1)