一、获取所有sheet
try
{
string strFileName = "d:\\Book1.xls";
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strFileName + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
conn.Open();
DataTable schemaTable = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
foreach (DataRow row in schemaTable.Rows)
{
for (int i = 0; i < schemaTable.Columns.Count; i++) {
Response.Write(row[i].ToString() + " ");
}
Response.Write("<br/>");
}
conn.Close();
}
catch (Exception ex)
{
}
浙公网安备 33010602011771号