I have an ASP.NET MVC app where a user can upload an xlsx file to be processed.
This creates a HttpPostedFileBase
object in the upload that has a handy stream method, HttpPostedFileBase.InputStream
.
I want to process the file using ClosedXML, but I don't know how to construct a XLWorkbook
object from a stream. Other SO answers use a normal file like this:
string fileName = "C:\\Folder1\\Prev.xlsx";
var workbook = new XLWorkbook(fileName);
This question explores how to SaveAs
as stream, but I want to create from a stream.
So how do you open a XLWorkbook
from a stream?