Hola,
Estoy intentando leer las hojas que contiene un excel, y por más que miro páginas no consigo que me las lea, siempre me muestra como nombre "tables" cuando tendría que tener hoja1 y hoja 2.
Este es el código que tengo.
No uso el api de office sino que lo hago con el oledb.
Dim oledbConn = New OleDbConnection(sConnectionString) Dim oledbCmd = New OleDbCommand(sqlExcel, oledbConn) Dim i As Integer Dim a As Integer Try oledbConn.Open() If ConnectionState.Open Then Dim DAdapter = New OleDbDataAdapter(oledbCmd) Dim LS_SQL As String Dim c As Integer Dim table As DataTable = CType(oledbConn, OleDbConnection).GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing) Dim nombrehojas(table.Rows.Count) As String For c = 0 To table.Rows.Count nombrehojas(c) = table.Rows.Item(c).Table.TableName.ToString Next