Hi
I have a function to return a DataView containing info on sheets in an Excel Workbook, as follows:
Public Function GetSchemaInfo() As DataView
Using connection As New OleDbConnection(GetConnectionString())
connection.Open()
Dim schemaTable As DataTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
connection.Close()
Return New DataView(schemaTable)
End Using
End Function
This works fine except that if the workbook has linked data (i.e. pulls its data from another workbook), duplicate sheet names are returned.
For example, Workbook1 has a single worksheet, Sheet1. I get 2 rows in the DataView, with the TABLE_NAME field being "Sheet1$" and "Sheet1$_".
OK, I could use a RowFilter, but wondered whether there was a better way or why this extra row is returned?
thanks
Richard