// 产生连接字符串
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=student.xls;"
+ "Extended Properties=‘Excel 8.0;HDR=YES;IMEX=1‘";
// 定义SQL
string sql = "SELECT * FROM [Sheet1$]";
DataTable dt = new DataTable();
using (OleDbConnection conn = new OleDbConnection(connString))
{
OleDbDataAdapter adapter = new OleDbDataAdapter(sql, conn);
adapter.Fill(dt);
}
dataGridView1.DataSource = dt;
原文:http://www.cnblogs.com/liuyudun/p/3812709.html