extrame / xls

Pure Golang xls library
Apache License 2.0
329 stars 207 forks source link

Getting dates instead of numbers #73

Open 0syntrax0 opened 4 years ago

0syntrax0 commented 4 years ago

I've been trying to get dates but instead I'm getting numbers. 1985-01-04T00:00:00Z | 1899-12-30T00:00:00Z. The numbers are hardcoded, no formulas or anything.

Only strings are returned correctly.

if xlFile, err := Open("Table.xls", "utf-8"); err == nil {
        if sheet1 := xlFile.GetSheet(0); sheet1 != nil {
            col1 := sheet1.Row(0).Col(0)
            col2 := sheet1.Row(0).Col(0)
            for i := 0; i <= (int(sheet1.MaxRow)); i++ {
                row1 := sheet1.Row(i)
                col1 = row1.Col(0)
                col2 = row1.Col(1)

                fmt.Print("\n", col1, " | ", col2)
            }
        }
    }

image

fatchul commented 3 years ago

have you any solution for this? @0syntrax0

0syntrax0 commented 3 years ago

have you any solution for this? @0syntrax0

Well, it wasn't a pretty solution. Since this file was sent by a customer, we decided to upload it to Google Docs and download it with a newer Excel version. Which worked just fine.

fatchul commented 3 years ago

have you any solution for this? @0syntrax0

Well, it wasn't a pretty solution. Since this file was sent by a customer, we decided to upload it to Google Docs and download it with a newer Excel version. Which worked just fine.

hmm after I check, current issue at this line https://github.com/extrame/xls/blob/master/col.go#L85 . so I try to copy this package to my local env then I update this line, it works