2

I need to basically import .xlsx file using NPOI in c#. Following is the code that I have written.

XSSFWorkbook xssfwb;
using (FileStream file = new FileStream(excelPath, FileMode.Open, FileAccess.Read))
{
  xssfwb = new XSSFWorkbook(file);
}

I am getting SystemOutOfMemory exception at the line of code xssfwb = new XSSFWorkbook(file); Can ane tell the reason why this is happening ?

user3751248
  • 303
  • 4
  • 8
  • 18
  • What's the file size? Is it too large. Check this - http://stackoverflow.com/questions/1153702/system-outofmemoryexception-was-thrown-when-there-is-still-plenty-of-memory-fr – malkam Jan 28 '15 at 13:33
  • 1
    The filesize is 10 mb and the number of rows are 213140. I think the link that you have shared is got to do with some other problem. – user3751248 Jan 28 '15 at 14:21
  • I tried with a smaller size file and it worked. How to handle larger files – user3751248 Jan 28 '15 at 19:44
  • I have the same issue, how did you solve that? – Muflix Mar 27 '22 at 11:44

0 Answers0