string source = "D:\\book1.xls";//execel文件的完整路径 string sqlconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + source + ";Extended Properties=Excel 8.0"; string sql = "SELECT * FROM [Sheet1$]"; OleDbCommand oldcom = new OleDbCommand(sql, new OleDbConnection(sqlconn)); OleDbDataAdapter oleda = new OleDbDataAdapter(oldcom); DataSet ds = new DataSet(); oleda.Fill(ds, "[Sheet1$]"); this.Label1.Text = ds.Tables[0].TableName; this.GridView1.DataSource = ds; this.GridView1.DataMember = "[Sheet1$]"; this.GridView1.DataBind(); 转载于:https://www.cnblogs.com/jevons/archive/2008/02/18/1072254.html