Data Discovery

Hello,

I have an excel spreadsheet I want to import into vb.net to display in a list view. Now i am currently importing it into a data set however I am coming accross and issue with this. I need a way to discover the names of the individual sheets in this workbook in order to properly import it. can anyone help me with this? also, is a list view the best way to display this data?

Thanks!
loureiroAsked:
Who is Participating?
 
ZeonFlashCommented:
If you are using an OLE connection, you can get the names of the sheets into a data table.  You can traverse through the data table at that point, looking in the Table_Column column for the names.

Dim dbcon As New OleDbConnection
Dim dtTable As DataTable = dbcon.GetOleDbSchemaTable(Data.OleDb.OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})

For Each row As DataRow In dtTable.Rows
    '...etc etc
Next
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.