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
Excel export and numbers #149
Comments
Minimal test case would help to identify where the issue is... |
That's the thing, there's no real test case, only a file that, when opened up in Excel, doesn't have the 'number' format at thus cannot be used in functions. |
The issue here is that the default Widget.render() returns force_text(value) which forces any numbers to a text representation. This seems to be a general problem with both importing and exporting Excel data. For example, I just tried to import an Excel sheet and one of the columns in my model is a models.DateField. The spreadsheet contains dates in the relevant column, which means the Dataset gets floating point numbers (Excel stores dates as floating point). The import_export DateWidget then tries to call strptime on the floating point value. I think the widget interface needs to know which external format is required. Text is fine for the text formats but just doesn't hack it for numbers, booleans, and date/time values. |
@murphyalexandre can you try changes in 149-excel-export-and-numbers branch and let me know if this fix the issue persists. @kupuguy good note, I agree for not converting numeric values to string. If format needs a string it will convert it itself. |
That last commit did the trick. Thank you so much! |
I'm trying to export numbers to Excel to be able to do sums, but it seems that the integer field is not being exported as a number.
Is there a way to force number export so that the cell format is right on load and we can do functions on those fields ?
The text was updated successfully, but these errors were encountered: