title: 'OutOfMemoryException' reading 20mb XLSX file
body: <p>I'm using <a href="https://www.nuget.org/packages/NPOI/" rel="nofollow">NPOI</a> to deal with Excel files. Here's how I'm reading files:</p>
  
  <pre><code>using (FileStream stream = File.OpenRead(excelFilePath))
  {
      IWorkbook wb = WorkbookFactory.Create(stream);
      ...
  }
  </code></pre>
  
  <p>However, for any XLSX file larger than a few megabytes, it causes memory usage to shot up to about 1GB and eventually throw an OOM exception.</p>
  
  <p>Doing some research, I've <a href="http://poi.apache.org/spreadsheet/quick-guide.html#FileInputStream" rel="nofollow">found out</a> that, strangely, loading a workbook from a File rather than a Stream results in less memory consumption by POI. The closest C# equivalent to the provided Java examples I've come up with to use Files is the following:</p>
  
  <pre><code>OPCPackage pkg = OPCPackage.Open(new FileInfo(excelFilePath));
  XSSFWorkbook wb = new XSSFWorkbook(pkg);
  </code></pre>
  
  <p>But it seems to use the same underlying implementation since the memory usage is still the same and causes OutOfMemory exceptions.</p>
  
  <p>Does NPOI have anything built-in for handling large XLSX files?</p>
  
  <p>Suggestions on alternative libraries that can handle both XLS and XLSX files are also welcome.</p>