How to read Excel file in c#

Sometimes you may need to read Excel file in c# and bind result in grid. Or you may need to store retrieved data into database. So here is the sample code which narrates how to read excel file in C#.

This code is able to read both extensions (.xls and .xlsx ) of excel file. Hope it will help you.