Sheetjs: Functions for number is not working in Excel , how to export as number instead of text?

Created on 20 Dec 2019  路  3Comments  路  Source: SheetJS/sheetjs

I am having the below :

{text: convertToCurrency(number) }

const convertNumberToCurrency = (value) => {
      return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(value).slice(0, -1)
}

We are having problems with Excel , the functions for number is not working with the above .

Do you have any recomendations :) ?

Most helpful comment

To be more specific, the cell object should have the type "n" for number, "v" should be the numeric value, and "z" should be the number format according to Excel. Generally you use something like "$#,##0.00" for dollars.

To find the specific style you need, set it in a sample file in Excel, then save the file and parse with SheetJS using the option cellNF: true, then inspect the cell object for that cell.

All 3 comments

try to write your cell like
A1: {v:123, t: "n"}
where n is the type for numbers and 123 is the value
馃檹

Thank you so much, i will try :)

To be more specific, the cell object should have the type "n" for number, "v" should be the numeric value, and "z" should be the number format according to Excel. Generally you use something like "$#,##0.00" for dollars.

To find the specific style you need, set it in a sample file in Excel, then save the file and parse with SheetJS using the option cellNF: true, then inspect the cell object for that cell.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eyalcohen4 picture eyalcohen4  路  3Comments

thomasledoux1 picture thomasledoux1  路  3Comments

jamesbillinger picture jamesbillinger  路  4Comments

seanmcilvenna picture seanmcilvenna  路  3Comments

nishthasb picture nishthasb  路  4Comments