Sunday, November 2, 2014

Use C# .Net to Load & Analyze Excel Sheet Data

Problem : This is something that repeatedly keeps on coming and I am putting it for my reference here. This snippet is of good use for anyone wanting to do data analysis on Excel Data Sheet by LINQ or by SQL like queries.

Solution : Following things to be noted in the code below:

  1. On windows you need to provide path with double backward slash (\\)
  2. The file that you are trying to open for analysis - As the connection string changes for the xls and xlsx file
  3. The name of the worksheet should end with $ sign
  4. Now once you have data table loaded in the memory one can start using Rows and Columns set to analyze data via C# Code

Best  case will be to analyze Stock Market data  through C# code as most of the Open Data is available in csv / excel format , but I will take that up some other time.

No comments:

Post a Comment