Free Support Forum -

Read Data From XLS


I’v created a xls file with MS Excel 2002 and put it to my web folder. In a later version this file should be uploaded by users and processed - but in a first step a manual copy should be enough. I attached my test excel file (number 12345 is written in SHeet 0 on A1)

I tried to read this file with Excel.Aspose I used code from one of your examples.

File = "IMportTest.xls"

Private Sub ReadFileAS(ByVal File As String)

Dim i As Integer = 0
Dim excel As Excel = New Excel
Dim designerFile As String = Page.MapPath(File)

Dim sheet As Worksheet = excel.Worksheets(0)
’ try to read cell A1 in sheet 0
Dim dt As DataTable = sheet.Cells.ExportDataTable(0, 0, 1, 1)

For i = 0 To dt.Rows.Count - 1
str = dt.Rows(i).Item(0).ToString

End Sub

In datatable no number is stored - every time i run the application another string value is displayed. A sample is Z9l6c4nhEoHAE. It seems to be a hash code or anything that.

Any idea how i get the 12345 value from cell A1 in sheet 0?

Thanks a lot
Kind regards

i forgot - i’m using an evaluation copy of Aspose.Excel

update about our testing activities. maybe it helps to solve the problem.

It seems to be a problem with number values. We place a string value in B1 and read. No problems.

We mask a number value with ’ - no success. The value returned is always a hash code.

Putting values works without problems for strings, numbers, booleans etc.

Any ideas how we can catch number values? What we have to do? Converting the excel file to string or anything else?

Thanks in advance

Hi Stefan,

It’s evaluation limitation instead of a bug. Please check for reference.

You can try to add some data in Cell F20. You will find now Cell A1 will work fine.