Hi. I'm working with Visual Studio 2022 and I have an application that uses excel. I'd like to know your opinion on the interfaces available: Interop, ClosedXML or any other. Which one is the best?
Thank you.
Loading
Hi. I'm working with Visual Studio 2022 and I have an application that uses excel. I'd like to know your opinion on the interfaces available: Interop, ClosedXML or any other. Which one is the best?
Thank you.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mayooran NavamanyPosted Oct 11, 2024, 1:30 AM
For working with Excel in .NET applications, there are several libraries you can choose from, each with its strengths. Here's a comparison of some of the most popular ones:
1. Interop (Microsoft.Office.Interop.Excel)Best For: Desktop applications where you need complete Excel functionality and the environment is guaranteed to have Excel installed.
2. ClosedXMLBest For: Applications that need to generate or read simple to moderately complex Excel files without requiring Excel to be installed. Great for server-based applications like web apps.
3. EPPlusBest For: Applications that need more advanced Excel features but want the performance of a non-Interop solution.
Leon DPosted Oct 14, 2024, 2:37 AM
You can also check Spire.XLS, it has a free version named Free Spire.XLS:
https://www.nuget.org/packages/Spire.XLS
https://www.nuget.org/packages/FreeSpire.XLS
This library supports various excel formats, including .xls, .xlsx, .xlsm, .xlsb, and more. Additionally, it operates independently, so there’s no need to have MS Office or any other software installed. Here is the library's official documentation for your reference:
https://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Spire.XLS-Program-Guide-Content.html
Tuhin PaulPosted Oct 12, 2024, 6:24 PM
ExcelPackageclass represents an Excel file. This creates a new instance of an Excel package, which will be the Excel file in memory.usingstatement ensures that the resources used by theExcelPackagewill be automatically disposed of once the operation is complete.Workbookproperty of theExcelPackageobject gets the workbook associated with the Excel file. A workbook can have multiple sheets.Cellsproperty is used to access specific cells by their row and column indices. The cell at position[1, 1](i.e., A1) is assigned the value "Hello", and[1, 2](i.e., B1) is assigned the value "World".SaveAsmethod saves the Excel package to a file. Here, the file is saved as "example.xlsx" in the current directory. TheFileInfoclass is used to specify the file location and name.Vishal YelvePosted Oct 11, 2024, 7:11 AM
Hi Ismael,
Do refer my article
https://www.c-sharpcorner.com/article/how-to-read-data-from-an-excel-sheet/
Tahir AnsariPosted Oct 11, 2024, 4:06 AM
Refer this article
https://www.c-sharpcorner.com/article/creating-excel-reports-with-epplus-in-asp-net-core-8-0/