I have been looking for a way to get the first worksheet name in a spreadsheet that I have uploaded.
Now, I have found many flavors or code when it comes to using Jet 4, but I have to use Ace 12, and when I use that driver, it will never get anything about the spreadsheet. Does anyone know a good way to pull the spreadsheet name with Ace 12?
Since all of the worksheet's are listed as table names you can use the OleDbConnection.GetOleDbSchemaTable() method to get a list of all worksheets in the file. I'm not sure about the order they are returned in, but I'd expect that they are in worksheet order.
DataTable dt = conn.GetOleDbSchemaTable(System.Data.OleDb.OleDbSchemaGuid.Tables, null);
string workSheetName = (string)dt.Rows[0]["TABLE_NAME"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With