C#读取excel

string strConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + FilePath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
            OleDbConnection conn = new OleDbConnection(strConn);
            conn.Open();
            OleDbCommand comm = new OleDbCommand("SELECT*FROM[Sheet1$]", conn);
            OleDbDataReader myReader = comm.ExecuteReader(CommandBehavior.CloseConnection);

你可能感兴趣的:(Excel)