Try below code snippet:
You need to add "Microsoft Excel 12.0 Object Library" to your project
using Microsoft.Office.Interop.Excel;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Microsoft.Office.Interop.Excel.Application app = new ApplicationClass();
Workbook workBook = app.Workbooks.Open(@"your_file_path",
0, true, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
Worksheet workSheet = (Worksheet)workBook.Worksheets.get_Item(1);
Range range = workSheet.UsedRange;
for (int i = 1; i <= range.Columns.Count; i++)
{
Console.WriteLine(((Range)range.Cells[2, i]).Value2);
}
Console.ReadLine();
}
}
}
Reference:
http://csharp.net-informations.com/excel/csharp-read-excel.htm[
^]