I'm using js-xlsx/xlsx.js library to export data to excel. https://github.com/SheetJS/js-xlsx
It works well except the formatting part for currency.
I used {v:12.34, z: '0.00%'} for percentage formatting, it works fine.
But when I use {v:1234.56, z :'$0.00'} for currency, then it does not work. No currency formatting in the export file.
Can anyone help me with this? Thanks!
I had the same issue and ended up using a forked version of the repo that has made some advancements in terms of formatting: https://github.com/protobi/js-xlsx
Instead of using the z
property of the cell, include the following:
{v: 42145.822, s: { numFmt: "m/dd/yy"}}
Check out https://github.com/protobi/js-xlsx#cell-object for more detail.