Torna al Thread
// Seleziona il foglio di lavoro
string strConnExcel = "provider=Microsoft.Jet.OLEDB.4.0; data source=" + fileExcel + "; Extended Properties=Excel 8.0;";
System.Data.OleDb.OleDbConnection ExcelConn;
ExcelConn = new System.Data.OleDb.OleDbConnection(strConnExcel);
ExcelConn.Open();
dt = ExcelConn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
String[] excelSheets = new String[dt.Rows.Count]; //vettore contenente i nomi di tabelle
int i = 0;
//Alimento il vettore
foreach (DataRow row in dt.Rows)
{
excelSheets[i] = row["TABLE_NAME"].ToString();
i++;
}