Reading Excel files from C#

2018-12-31 01:22发布

Is there a free or open source library to read Excel files (.xls) directly from a C# program?

It does not need to be too fancy, just to select a worksheet and read the data as strings. So far, I've been using Export to Unicode text function of Excel, and parsing the resulting (tab-delimited) file, but I'd like to eliminate the manual step.

30条回答
永恒的永恒
2楼-- · 2018-12-31 01:28

If it's just tabular data. I would recommend file data helpers by Marcos Melli which can be downloaded here.

查看更多
谁念西风独自凉
3楼-- · 2018-12-31 01:29

The .NET component Excel Reader .NET may satisfy your requirement. It's good enought for reading XLSX and XLS files. So try it from:

http://www.devtriogroup.com/ExcelReader

查看更多
高级女魔头
4楼-- · 2018-12-31 01:31

I know that people have been making an Excel "extension" for this purpose.
You more or less make a button in Excel that says "Export to Program X", and then export and send off the data in a format the program can read.

http://msdn.microsoft.com/en-us/library/ms186213.aspx should be a good place to start.

Good luck

查看更多
深知你不懂我心
5楼-- · 2018-12-31 01:32

How about Excel Data Reader?

http://exceldatareader.codeplex.com/

I've used in it anger, in a production environment, to pull large amounts of data from a variety of Excel files into SQL Server Compact. It works very well and it's rather robust.

查看更多
牵手、夕阳
6楼-- · 2018-12-31 01:32

ExcelMapper is an open source tool (http://code.google.com/p/excelmapper/) that can be used to read Excel worksheets as Strongly Typed Objects. It supports both xls and xlsx formats.

查看更多
与风俱净
7楼-- · 2018-12-31 01:32

SpreadsheetGear is awesome. Yes it's an expense, but compared to twiddling with these other solutions, it's worth the cost. It is fast, reliable, very comprehensive, and I have to say after using this product in my fulltime software job for over a year and a half, their customer support is fantastic!

查看更多
登录 后发表回答