[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

Reading Excel


I have written a c# winfoms application, which can read data from excel file. I have used oledb to connect to excel files. When i tried deploying that to one of our client system, i found that there is no MS office installed in that system, hence it is throwing an error if i run the exe. Can anyone suggest me what should i do in this case. its bit urgent please.

2 Solutions
Éric MoreauSenior .Net ConsultantCommented:
with a 3rd party component like http://www.aspose.com/categories/.net-components/aspose.cells-for-.net/default.aspx, you don't need Excel to be installed
You can use any one of a growing number of free .Net libraries to do this. Here are a few examples:

EPPlus: Example
NPOI: Example : More Examples

What's nice with these libraries is that they do not use Excel Automation, which would require Excel to be installed on the server and generally is not scalable.

Anyway, once you've managed to read the data, you can loop through the cells in the desired worksheet and write them out as HTML.

Another approach here is to read the Excel file into a dataset using ODBC and then looping through the dataset and writing the data out as HTML. http://www.dotnetspider.com/resources/15591-How-read-EXCEL-data-file-asp-net.aspx

GemBox have a .NET Excel Manipulation library which you can also look at. They have a free version, limited to a maximum of 150 rows per worksheet and 5 worksheets per workbook. If your data meets, then it's worth a try. http://www.gemboxsoftware.com/spreadsheet/free-version

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now