Is it safe to use Excel Interop inside MVC app?
Close all workbooks and exit ExcelOn the File tab, click Exit.
Office. Interop. Excel' nuget package, and then add reference to 'Microsoft Excel 16.0 Object Library' (right click the project -> 'Add' -> 'Reference' -> search and add 'Microsoft Excel 16.0 Object Library' ). Click ''Interop.
It does not require Excel to be installed on the server. It doesn't use Excel libraries, it is just an API interface to the Open Office XML format (xlsx). XLSX is actually just a a zip file with a folder structure and xml files inside to describe the layout and data of the spreadsheet.
epplus.codeplex.com. The codeplex site has tons of examples plus here's an additional blogpost with more.
Just putting this here as an Actual answer.
Assuming you mean ASP.NET MVC trying to run Excel on the server, the answer is that it's not recommended. Excel is really designed as a desktop app, so running it on a server can cause some problems, as described on in this MSDN article.
If you can target Excel 2007/2010, a good alternative is to use the Open Office XML libraries to create, read or modify Excel workbooks without instantiate and Excel instance. Take a look at www.openxmldeveloper.org
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With