spout icon indicating copy to clipboard operation
spout copied to clipboard

setShouldFormatDates(false) Bug?

Open devops-at-alinea opened this issue 6 years ago • 3 comments

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",

devops-at-alinea avatar Jul 05 '18 16:07 devops-at-alinea

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.

melihyenel avatar Aug 06 '18 20:08 melihyenel

@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

adrilo avatar Aug 09 '18 21:08 adrilo

@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

devops-at-alinea avatar Aug 10 '18 08:08 devops-at-alinea