amschaal / django-ezreg

4 stars 3 forks source link

xls/xlsx exports numbers as text #103

Open monicabritton opened 6 years ago

monicabritton commented 6 years ago

Since the fix for #93, downloads of xls and xlsx have numbers "tagged" as text. I tried both LibreOffice and MS Excel. This then requires an extra step to convert to numbers before summing columns, etc.

amschaal commented 6 years ago

This unfortunately seems like a shortcoming of the tablib library: https://github.com/kennethreitz/tablib/issues/252 https://github.com/kennethreitz/tablib/pull/309

It seems work was started to resolve it, but it hasn't made it into master yet. Besides it getting resolved by tablib, the only other options is to find another cross format library. The only one I can think of is pandas, but that is way too heavy.

Can you just tag them yourself when necessary?

monicabritton commented 6 years ago

Oddly, the xls output did parse the numbers correctly up until a few months ago. (At that time xlsx didn't work at all). See #93 . Text vs. numeric isn't a problem if you're not trying to use the number in a calculation. My current solution is to insert a column and add a function to convert.

amschaal commented 6 years ago

Interesting that you need another column. I assumed it would be easy to just redefine the column as numeric, date, or whatever. Of course, I'm no expert at spreadsheets.