ASP.NET读取Excel数据源

       DataTable dt = null;
            string conStr = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR=YES;IMEX=1'", _excelPath);
            string sql = "select * from [Sheet1$]";

            try
            {
                OleDbConnection con = new OleDbConnection(conStr);
                OleDbDataAdapter da = new OleDbDataAdapter(sql, con);
                dt = new DataTable();
                da.Fill(dt);
                con.Close();
                return dt;
            }
            catch
            {
                return null;
            }

原文地址:https://www.cnblogs.com/shuzehui/p/1884907.html