Hi sree,
Of course you can. You have few possibilities, I will mention 3 here.
- Read the Excel file with the ACE/JET driver. You will get a recordset which you can then browse. This is suitable only for excel file having the data in a table format, and you are sure of each of the columns data type
- Reference the Excel.Exe object. And use it in your code. You can then read the excel values by cell address. This has a shortfall though. Your client needs to have exact excel version with the version you are referencing.
- Late bind the Excel object and harness the power of dynamic data type in C# introduced in C# 3.5. This is the same as point 2. But without the shortfall above. It should work with any excel version, the down side is no intelisense.
What I usually do is to use 2nd point during the development (this way I get the intellisense) and then before deployment, switch it to late bind the object (point 3)
Regards
Edy