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

Reading data formatted as date always returns numbers #47

Open
demontiejr opened this issue Sep 16, 2020 · 8 comments
Open

Reading data formatted as date always returns numbers #47

demontiejr opened this issue Sep 16, 2020 · 8 comments

Comments

@demontiejr
Copy link

Hi,

I'm trying to use the library to process very large files and they contain date columns. When reading the values, I'm always getting numbers (the underlying numeric value for the date). Since I don't know in advance what's the data type for a particular column, I'd like to be able to identify it from the formatting.

I tried using cell.Type() == types.CellTypeDate() to decide whether I could explicitly get the value parsed to Time (with the Date function) but it's always returning false. I then tried to get the style ID and use the style sheet to get the info and check whether it's a date, but then I saw that this method is not implemented.

xlsx/style_sheet.go

Lines 214 to 227 in 4538b54

func (ss *styleSheet) resolveDirectStyle(id ml.DirectStyleID) *styles.Info {
if id == 0 {
return nil
}
panic(errorNotSupported)
//cellStyle := ss.ml.CellXfs.Items[id]
//style := &styles.Info{}
//_ = cellStyle
//TODO: Populate format.Info with required information
//return style
}

Is there a way I can identify dates right now? If not, can you point me to how I can solve this issue so I can send a pull request?

Thanks,
Demontiê

@demontiejr
Copy link
Author

@plandem I sent this pull request to solve this specific issue: #48

Can you PTAL?

@plandem
Copy link
Owner

plandem commented Sep 22, 2020

@demontiejr Hi. May I ask you to add tests for your new function?!

@plandem
Copy link
Owner

plandem commented Sep 22, 2020

thanks, for you contribution!

@demontiejr
Copy link
Author

Sure. I closed that particular PR because I saw it was missing a few things. I'll send a new one and include the tests.

@demontiejr
Copy link
Author

Hey @plandem, I just created a clean branch with the changes and added the unit tests as you requested. Can you take a look at #51?

@demontiejr
Copy link
Author

@plandem just a friendly bump. :)

@plandem
Copy link
Owner

plandem commented Nov 10, 2020

hey. thanks for PR. I checked it, but wanted to double-check for these few changed format code - you replaced “-“ with “/“, so i wanted to check official docs about these codes. I believe that used from official docs, but could be wrong. will do it on weekends!

@demontiejr
Copy link
Author

Hey @plandem, did you have the change to look into the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants