Number formats not supported in .ODS
See original GitHub issueconst XLSX = require('xlsx');
const wb = XLSX.utils.book_new();
const ws = XLSX.utils.json_to_sheet([{ dummy: '' }]);
XLSX.utils.book_append_sheet(wb, ws, 'Bug sheet');
ws.A1 = { t: 'n', f: '-10*20', z: '$0.00' };
XLSX.writeFile(wb, 'bug.ods'); // change extension to .xlsx and the format *is* output
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Solved: Numeric Format in Excel ODS - SAS Communities
Hi,. My code creates an XML based Excel file using ODS. I'd like to format the numeric fields using the format "COMMAw.d". For...
Read more >Differences between the OpenDocument Spreadsheet (.ods ...
Area Subarea Level of Support
Excel for Microsoft 365 and Excel 2021
Formatting Row Heights/Column widths Supported. Appearance should be similar.
Formatting Cell Supported
Read more >Number formats for OpenDocument ODS - Lazarus Forum
I am currently trying to implement writing of ods number formats for fpspreadsheet and got stuck with the percentage format which is not...
Read more >Trouble Converting ODS files to XLS - Apple Community
You need to install Open Office for Mac, open the .ods spreadsheets and save as .xls. Then Numbers can open the file. User...
Read more >Set Conditional Formats of Excel and ODS files.|Documentation
If the value of the cell does not meet the format condition, the cell's default formatting is used. In Microsoft Excel, select Format,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There are multiple parts to this discussion. The SheetJS number format representation aligns with the text string in Excel.
OpenDocument vs Excel
OpenDocument stores number formats as a stream of tokens in XML. For example, this is the format for LibreOffice
WW QQ
:Excel does not have support for the “week of year” (you can use the
WEEKNUM
function to get the same info, but it is not available as a token in the Number Format).This is not particularly difficult, but it would require some decision on how to map unsupported features between ODS and the SheetJS number format.
LibreOffice vs OpenDocument
LibreOffice translates the OpenDocument XML representation into its own Number Format string. The bulk of the issues lie in this chasm.
The ODF spec asserts that the default calendar system for the locale should be used. LibreOffice always appears to follow the gengō scheme. This has unexpected behavioral differences where
en-US
era is 2022 in Excel and ODF but 5782 in LibreOfficeLibreOffice vs Excel
In addition to the aforementioned issues, there are subtle mapping issues like
EEEE
(corresponds to one rendering of long Era in Excel but two renderings in LibreOffice)Y
is 2-digit year in Excel, but literalY
in LibreOffice.YYY
is 4-digit year in Excel, but 2-digit year followed byY
in LibreOffice.Open Questions
Coming from LibreOffice, does the library need to translate between SheetJS and LibreOffice style number formats?
How should unsupported features be handled?
Note that this same issue affects Numbers. For example, the Duration cell formats in Numbers support week/day/hr/min/sec/ms while Excel only supports absolute hr/min/sec
Happy New Year! 🎆 Any updates on this? Currency formats are an important feature.