Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

setShouldFormatDates(false) Bug? #578

Open
devops-at-alinea opened this issue Jul 5, 2018 · 3 comments
Open

setShouldFormatDates(false) Bug? #578

devops-at-alinea opened this issue Jul 5, 2018 · 3 comments

Comments

@devops-at-alinea
Copy link

Following on from #481, I still think there is a need for returning raw cell data.

The attached xlsx has a cell C2 with a custom format which is is incorrectly recognised as a date.
The cell has a value 1 formatted to look like 1 ST, spout returns this as:
{ "date": "1900-01-01 00:00:00", "timezone_type": 3, "timezone": "UTC" },

Presumably becuase it thinks it's getting a date starting with: 1st ....?

If I use $reader->setShouldFormatDates(true); then spout returns:
#,##0 ST

Neither is correct. If I had the option to return raw cell data I could at least extract a value of 1 and work with that.

test.xlsx

using "box/spout": "^2.7",

@melihyenel
Copy link

I have the exact same issue when reading an excel file. Did you come up with a solution @devops-at-alinea?

I also agree with you, this nice library should have a "return raw cell data" option.

@adrilo
Copy link
Collaborator

adrilo commented Aug 9, 2018

@melihyenel You should not need such an option if the library returns you the right data :)

@devops-at-alinea What do you expect Spout to return? If the cell has a timestamp value set to 1, it's normal that it returns { "date": "1900-01-01 00:00:00", "timezone_type": 3, "timezone": "UTC" }.

When setting $reader->setShouldFormatDates(true);, you expect Spout to return "1 ST" right?
Spout does not seem to be able to interpret the #,##0 part... I need to look into this

@devops-at-alinea
Copy link
Author

@adrilo I omitted to mention that the 1 ST is actually a measure of quantity, ST stands for Stück which I believe means per piece.

So the cell doesn't have a timestamp value of 1, it simply has a value of 1 and a custom format #,##0 "ST" so I would expect Spout to return 1 ST

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

No branches or pull requests

3 participants