using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExcelExample.Excel
{
    public class AddExcelClass
    {
        public DataView GetDataView(string path)
        {
            OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;data source='"+ path + "';Extended Properties=\"Excel 8.0;HDR=NO;IMEX=1\"");
           connection.Open();
            OleDbDataAdapter dataAdapter;
            dataAdapter = new OleDbDataAdapter("select * from [Sheet1$A1:D]", connection);
            DataTable dataTable = new DataTable();  
            dataAdapter.Fill(dataTable);
            return dataTable.DefaultView;
        }
    }
}
