Reputation: 7894
I need to access an excel file, but the application needs to run on a server with no Office installation - so interop is out of the question.
I know there is OleDbConnection, which will work, but is having strange effect when reading in Header rows. When looking at headers, it will replace "." with "&" because it is treating the header as a database column name, and "." is unacceptable. So, I tried to read the headers in as data, but this caused certain columns to be null - particularly when using dates.
Anyway - looking for a way to read in Excel cell values without using these two methods?
P.S. Also trying to avoid 3rd party libraries - unless they're lightweight and free...
Upvotes: 1
Views: 1085
Reputation: 34426
Try ExcelPackage. It's no longer in development but it still works very well and has a lot of people using it. For any bugs you come across, check out the discussions, as most people have come up with fixes and patches to any standard issues you find. Some of those have been submitted as patches.
Upvotes: 0
Reputation: 15663
Not too hard, though one package don't quite do it all.
.xls : ExcelLibrary
.xslx : ExcelPackage
Upvotes: 1
Reputation: 6062
you dont mention what you actually need it for, if you are querying there are some LINQ to Excel solutions
just noticed you 3rd part restriction however the above may still be suitable
Upvotes: 4