I have tabulator grid and it has some currency values, but when exporting them to excel, excel formulas are not working.
formatter: "money",
formatterParams: {
decimal: ",",
thousand: ".",
symbol: "$",
precision: 2,
}
https://jsfiddle.net/zv30o5e1/1/
So please let me know how to use that, I need thousand separator and $ as prefix in excel.
Thanks, Laxmi Lal
I think you are on the right track by using the accessorDownload
option. One way would be to use Intl.NumberFormat()
method to convert the value string to US dollars ($ prefix). Here is an example forked from your fiddle: https://jsfiddle.net/y4u7zet1/
UPDATE
If you need to set the Number format at Excel level, then instead of using accessorDownload
, this can be done by modifying the workbook with SheetJS methods during tabulator export using documentProcessing
callback.
You can loop thru tabulator data and set the format, based on SheetJS number formats (https://docs.sheetjs.com/docs/csf/features/nf#currency), to each cell of the column you need. Here is an updated fiddle: https://jsfiddle.net/vtcheu75/1/