We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Reading large excel sheet

I am trying to read excel sheet and I only returns the contents of the first row.
Bookseller am using the following code Syncfusion.XlsIO.Base.dll and. Attached excel sheet.

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

Dim excelEngine As ExcelEngine = New ExcelEngine()

Dim application As IApplication = excelEngine.Excel

'Open the existing workbook

Dim workbook As IWorkbook = application.Workbooks.Open("C:\Temporal\Dtos.xlsx")

'The first worksheet object in the worksheets collection is accessed.

Dim sheet As IWorksheet = workbook.Worksheets("Descuentos_Clientes")

Dim j As Int32

 

 

j = 2

 

Dim Id_Cliente, GrupoTarifa, DTO1, DTO2 As String

Id_Cliente = Trim(sheet.Range(j, 1).Text & "")

GrupoTarifa = Trim(sheet.Range(j, 2).Text & "")

DTO1 = Trim(sheet.Range(j, 3).Text & "")

DTO2 = Trim(sheet.Range(j, 4).Text & "")

While Id_Cliente.Trim.Length <> 0 And GrupoTarifa.Trim.Length <> 0

 

 

j = j + 1

 

Id_Cliente = Trim(sheet.Range(j, 1).Text & "")

GrupoTarifa = Trim(sheet.Range(j, 2).Text & "")

DTO1 = Trim(sheet.Range(j, 3).Text & "")

DTO2 = Trim(sheet.Range(j, 4).Text & "")

End While

 

workbook.Close()

 

End Sub



Dtos_9c6ad42b.zip

1 Reply

SR Sridhar Syncfusion Team July 30, 2013 04:30 AM UTC

Hi Jesus Perez Del Postigo,

Thank you for using Syncfusion products.

We could see the given excel file is preserved with number values and does not stored under string values. So, can you please make use of the DisplayText to get the text displayed in the excel cell.

Please get the modified code snippet for the same.

Code Snippet [VB]:

Id_Cliente = Trim(sheet.Range(j, 1).DisplayText & "")
GrupoTarifa = Trim(sheet.Range(j, 2).DisplayText & "")
DTO1 = Trim(sheet.Range(j, 3).DisplayText & "")
DTO2 = Trim(sheet.Range(j, 4).DisplayText & "")

Please try the above code snippet at your side and let me know if this helps you.

Please let me know if you have any further clarifications.

Thanks,
Sridhar.S


Loader.
Live Chat Icon For mobile
Up arrow icon