Ver Mensaje Individual
  #3 (permalink)  
Antiguo 06/05/2013, 06:55
maialenlopez
 
Fecha de Ingreso: abril-2012
Mensajes: 449
Antigüedad: 12 años
Puntos: 7
Respuesta: Leer datos de excel desde vb.net

Cita:
Iniciado por josemanuel31675 Ver Mensaje
Bueno yo uso la dll EPPlus me funciona muy bien, te anexo mi codigo para que puedas realizar lo que tu necesitas

Dim NewFile As FileInfo = New FileInfo(Server.MapPath("uploaded.xlsx"))
Dim NewTemplate = New FileInfo(Server.MapPath("uploaded.xlsx"))
Dim XlPackage = New ExcelPackage(NewFile, NewTemplate)
Dim sheetDatos = XlPackage.Workbook.Worksheets(Me.TxtHoja.Text)

If sheetDatos IsNot Nothing Then

Dim Termine As Boolean = False
Dim Fila As Integer = 9

While Not Termine

archivo = sheetDatos.Cells("C" & Fila).Value

Try
If archivo IsNot Nothing Then

If Fila = 9 Then
Dim Fecha As Date = sheetDatos.Cells("P" & Fila).Value
Query.BorrarMesalSubir(Fecha.Month, Fecha.Year)
End If

row = tabla.NewRow

row.Item = sheetDatos.Cells("A" & Fila).Value
row.Planta = sheetDatos.Cells("B" & Fila).Value

tabla.Rows.Add(row)
adapt.Update(tabla)

Else
Termine = True
End If

Fila = Fila + 1

Catch ex As Exception
'MsgBox(ex.Message, MsgBoxStyle.Critical)
Exit Sub
End Try
End While

End If


Catch ex As Exception

End Try
Hola,
No entiendo muy bien como lo haces.
¿No se podría hacer como lo estoy haciendo yo? ¿Alguien me puede echar una mano?
__________________
Gracias por todo;

Un saludo