I'm using the OleDbConnection to retrieve data from a .xlsx workbook. When I retrieve a list of worksheets it doesn't identify if any of them have been hidden. This used to be the case by ending it's name with an underscore eg "Sheet1$_". Do you know how to tell if this is hidden now?
using (var connection =
new OleDbConnection(string.Concat("Provider=Microsoft.ACE.OLEDB.12.0;Mode=Read;Data Source=",
fileName,
";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"")))
using (var command = new OleDbCommand("", connection))
{
connection.Open();
var listedSheets = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {null, null, null, "Table"});
if (listedSheets != null)
{
var sheetNames = new List<string>(listedSheets.Rows.Count);
foreach (DataRow row in listedSheets.Rows)
{
sheetNames.Add(row[2].ToString());
}
return sheetNames;
}
return new List<string>();
}