You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to use excelize to record some financial data (in US Dollars). This requires using decimal values that have exactly 2 decimal places for cents. Excelize only supports numbers represented as int or float. Upon closer examination of how cell values are set internally, it looks like they are stored as a combination of value (stored as a string), and type. Is there anyway for excelize to support either:
Storing decimal precision values natively
Setting the value and type directly so that I can serialize decimal precision values to a string, and set the type to a number directly
The text was updated successfully, but these errors were encountered:
Thanks for your issue. This is similar to issues #80 and #189. Excelize library support sets custom Accounting number format or built-in number format for cells.
Thanks for the quick response - unfortunately I don't think formatting alone is sufficient here.
Right now, the only way to set numeric cell values is through using the int or float types directly. Since float is not able to capture decimal (base 10) values exactly, there are potential rounding errors if I try to save exact decimal values with the current API.
For more context, this stack overflow question captures my concerns with trying to use a float and using a number formatter that will just round the value for financial values.
Could you show us a numeric precision problems case about this? The SetCellDefault function supports storage cell value as numeric by a given string data type value, but if you open the generated workbook, the display cell value is also related to the Excel accuracy limitation.
Description
I am attempting to use excelize to record some financial data (in US Dollars). This requires using decimal values that have exactly 2 decimal places for cents. Excelize only supports numbers represented as
int
orfloat
. Upon closer examination of how cell values are set internally, it looks like they are stored as a combination of value (stored as astring
), and type. Is there anyway for excelize to support either:The text was updated successfully, but these errors were encountered: