olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.78k stars 821 forks source link

Money formatter exported as string in excel #4248

Closed laxmi-lal-menaria closed 1 year ago

laxmi-lal-menaria commented 1 year ago

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, }

So please let me know how to use that, I need thousand separator and $ as prefix in excel.

olifolkerd commented 1 year ago

Formatters are visual only, they do not affect the underlying data of the table, in you case you should look at using the clipboard accessor accessorClipboard

https://tabulator.info/docs/5.5/clipboard#accessors

Cheers

Oli :)

DNF-SaS commented 4 months ago

Hi Oli,

I have the same problem here with the excel-export plugin. I'd like to get a comma as decimal separator, but it keeps using the TabulatorJS-internal format (a dot as decimal separator). What could I do? (I can't follow your answer regarding accessorClipboard - can you give me a hint?)

Cheers Sascha :-)

laxmi-lal-menaria commented 4 months ago

This is working code... it is for currency, but you can remove the '$'.

`//Export $("#exportExcel").on("click", function(evt) { const sheetName = "MyData"

table.download("xlsx", "data.xlsx", { sheetName: sheetName, documentProcessing: (workbook) => { const rows = table.getRows(); rows.forEach((row, index) => { const cell = "H" + (index + 2); workbook.Sheets[sheetName][cell].z = '"$"#,##0.00_);\("$"#,##0.00\)'; }); return workbook; } }); });`

laxmi-lal-menaria commented 4 months ago

Working JS Fiddle.

https://stackoverflow.com/questions/76768979/tabulator-money-formatter-exported-as-string-in-excel

On Mon, Jul 22, 2024 at 10:31 AM DNF-SaS @.***> wrote:

Hi Oli,

I have the same problem here with the excel-export plugin. I'd like to get a comma as decimal separator, but it keeps using the TabulatorJS-internal format (a dot as decimal separator). What could I do? (I can't follow your answer regarding accessorClipboard - can you give me a hint?)

Cheers Sascha :-)

— Reply to this email directly, view it on GitHub https://github.com/olifolkerd/tabulator/issues/4248#issuecomment-2242092517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAELGAQUMHKEFNTMQ4NMVODZNSG2VAVCNFSM6AAAAABLHRN5DGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBSGA4TENJRG4 . You are receiving this because you authored the thread.Message ID: @.***>

--

Thanks, Laxmilal Menaria | +91 982 955 3793 | http://cloud-computing.solutions/

DNF-SaS commented 4 months ago

Working JS Fiddle. https://stackoverflow.com/questions/76768979/tabulator-money-formatter-exported-as-string-in-excel Thanks a lot - this pointed me in the right direction (to use a downloadAccessor - I would never have found it)