Suggestions for reading data from excel in .net c#

怎甘沉沦 提交于 2019-12-03 20:46:45

SpreadsheetGear for .NET will do it.

You can see ASP.NET samples with C# and VB source here and download the free trial here if you want to try it out.

Disclaimer: I own SpreadsheetGear LLC

Using ASPOSE Tools

Using ADO.NET

Do you need graphic support?

Im using the ComponentOne XLS component right now. It is pretty stable and does it job. Im using it for data integration too.

I also wanted to do some xls reports, however the API does not support the full excel stack (not even launching an excel instance) so i had to go over Mirosoft.Office.Interop

One of alternatives: MS Office Wrapper for .NET

you can use LINQ to XML also, see the link below...

Video Tutorial

We're currently using Flexcel. It has some nice features including a tool for reading a spreadsheet and generating the necessary C# (or VB or Delphi) code to generate that sheet using their toolkit -- it makes designing a sheet a snap. The licensing wasn't expensive (site license for developers, redistribution free).

The only thing against it is that XLSX (Excel 2007 native format) compatibility is "real soon now".

Read this blog post on Reading and Writing Excel Spreadsheets.

Reading and Writing Excel Spreadsheets

Mark Redman

You can do something like this:

// Connection String to Excel Workbook
string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0;HDR=YES;\"";

OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter("Select * FROM [Sheet1$]", excelConnectionString);

DataSet dataSet = new DataSet();

oleDbDataAdapter.Fill(dataSet);

Also see "SqlBulkCopy"

Ultimately we opted for Syncfusion's XLSIO which works well.

Thanks for the other suggestions too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!