xls icon indicating copy to clipboard operation
xls copied to clipboard

Getting dates instead of numbers

Open 0syntrax0 opened this issue 5 years ago • 3 comments

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

0syntrax0 avatar Sep 21 '20 15:09 0syntrax0

have you any solution for this? @0syntrax0

fatchul avatar Mar 24 '21 05:03 fatchul

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.

0syntrax0 avatar Mar 24 '21 15:03 0syntrax0

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

fatchul avatar Mar 25 '21 01:03 fatchul