How do I find out the hidden excel sheet name using ADO(OLEDB) in C#?
In My Excel workbook there are a lot of sheets. Only one Excel sheet is in hidden mode. I need to find out the names of hidden sheets. My code finds both hidden and visible sheets.
This is my code to find excel sheet names for all sheets. Is it possible/can any one tell me how to find out hidden excel sheet names without using Interop services in C#?
connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + excelFile + ";Extended Properties=\"Excel 12.0;;IMEX=1;HDR=YES\"";
query = String.Format("SELECT * FROM [{0}", fileName + "]");
OleDbCommand objCmd = new OleDbCommand(query, objCon);
OleDbDataAdapter adap = new OleDbDataAdapter(objCmd);
adap.FillSchema(dtExcelSchema, SchemaType.Mapped);
adap.Fill(dsExecelData);
If the sheet name ends with an underscore (_) then its hidden. Regular sheet names will end with a dollar sign ($).