Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I get the correct date data? #1375

Closed
zjfGH opened this issue Oct 20, 2022 · 2 comments
Closed

How can I get the correct date data? #1375

zjfGH opened this issue Oct 20, 2022 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@zjfGH
Copy link

zjfGH commented Oct 20, 2022

cellType, _ := file.GetCellType("Sheet1", "A1")
value, _ := file.GetCellValue("Sheet1", "A1")

fmt.Println(cellType)
fmt.Println(value)

expected console 1

2 //CellTypeDate
44854

expected console 2

5 //CellTypeString
2022/10/20

actual console

0 //CellTypeUnset
44854

I can't get any kind of desired results, How can I get the correct date data?
t.xlsx

@xuri
Copy link
Member

xuri commented Oct 20, 2022

This issue was similar to #1041. The date/time is also stored as numeric in the spreadsheet, which format by date number format style, the cell type representing the cell's data type, which may not be the same as the data type by number format formatted. The type of numeric cell used by default in the spreadsheet, so you get the CellTypeUnset type. In another words, Both types CellTypeUnset and CellTypeNumber are numeric cells. According to the spreadsheet specification ISO/IEC 29500 5th §18.18.11, you only get CellTypeDate when a cell contains a date in the ISO 8601 format.

@xuri xuri added the duplicate This issue or pull request already exists label Oct 20, 2022
@xuri
Copy link
Member

xuri commented Oct 21, 2022

I closed this issue. If you have any questions, please let me know to reopen this anytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants