I'm pretty new to C# and programming. I have an excel file with more than 100 sheets. In each sheet I have more than 200 lines with data (4 columns on each line). I need to use data from each sheet in a C# project. Do I need to use a database to upload the data from sheets? If yes, what database to use and how can I put values from Excel to this database to use them after in C# more easily? I read Google to find how can I do this but I found a lot of things and I don't understand. Thank you!
Asked
Active
Viewed 187 times
2 Answers
0
There are a few possible solutions:
- Use an library to access excel. There are several alternatives, but ExcelDataReader seem to be one of the most downloaded one.
- Use ADO.Net to access the excel file. This treats the excel file as a database, and might be a bit difficult to use unless you are comfortable with SQL.
- Use excel interop library. This will require that excel is installed on the machine that is used.

JonasH
- 28,608
- 2
- 10
- 23
-
I do not recommend to use Excel Interop. MS Office Interop is slow and even Microsoft does not recommend Interop usage on server side. For more details see what Microsoft stated on [why not to use OLE Automation](https://support.microsoft.com/en-us/help/257757/considerations-for-server-side-automation-of-office). – alex.pulver Jun 27 '20 at 08:54
0
You don't need a database. You can use OpenXML to import your data in C#.
You may find plenty of examples about how to import data with OpenXML, this is only one of them:
From Excel to DataTable in C# with Open XML
There are also other open source Excel libraries that you can use. OpenXML is from Microsoft and it was built specially for handling Excel files.

alex.pulver
- 2,107
- 2
- 31
- 31