1
Answer

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

Raja

Raja

8y
415
1
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)
0
Prateek Singla

Prateek Singla

NA 558 859 8y
 Hi Raja,
 
 Use Closedxml for reading and writting excel file it is quite easy to use 
 
https://closedxml.codeplex.com/wikipage?title=Showcase&referringTitle=Home
 
https://closedxml.codeplex.com/documentation