Specify European Currency Column #2827

Open
opened 2022-11-14 09:29:05 +00:00 by jazib17 · 3 comments

I am trying to generate an excel file in which a column should be treated as currency.
Now how can I specify column as European currency? Like European currency contains comma instead of decimal.
Example: 533.6 should be treated as 533,6

I am trying to generate an excel file in which a column should be treated as currency. Now how can I specify column as European currency? Like European currency contains comma instead of decimal. Example: 533.6 should be treated as 533,6
Owner

Thousands separator and decimal symbol are system settings. When exporting, use the normal en-US style (e.g. #,##0 or #,##0.00) and Excel automatically interprets the format using the regional settings. You can actually experiment by changing your system separators and watching Excel use the new settings.

Unfortunately the Excel formats have no way of marking the regional settings of the computer that last saved the file.

Thousands separator and decimal symbol are system settings. When exporting, use the normal en-US style (e.g. `#,##0` or `#,##0.00`) and Excel automatically interprets the format using the regional settings. You can actually experiment by changing your system separators and watching Excel use the new settings. Unfortunately the Excel formats have no way of marking the regional settings of the computer that last saved the file.
jazib17 reopened this issue 2022-11-14 11:17:13 +00:00
Author

Kindly tell me where do I specify the currency format for the column?

  exportexcel(): void {
    /* pass here the table id */
    const element = document.getElementById('excel-table');
    const ws: XLSX.WorkSheet = XLSX.utils.table_to_sheet(element, {dateNF: 'dd/mm/yyyy;@', cellDates: true, raw: true});

    /* generate workbook and add the worksheet */
    const wb: XLSX.WorkBook = XLSX.utils.book_new();
    XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');

    /* save to file */
    XLSX.writeFile(wb, this.fileName);

  }
Kindly tell me where do I specify the currency format for the column? ``` exportexcel(): void { /* pass here the table id */ const element = document.getElementById('excel-table'); const ws: XLSX.WorkSheet = XLSX.utils.table_to_sheet(element, {dateNF: 'dd/mm/yyyy;@', cellDates: true, raw: true}); /* generate workbook and add the worksheet */ const wb: XLSX.WorkBook = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); /* save to file */ XLSX.writeFile(wb, this.fileName); } ```
Owner

Remove raw: true. https://docs.sheetjs.com/docs/api/utilities#html-table-input -- for HTML tables, raw keeps the raw HTML strings while the default tries to parse values

Remove `raw: true`. https://docs.sheetjs.com/docs/api/utilities#html-table-input -- for HTML tables, `raw` keeps the raw HTML strings while the default tries to parse values
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2827
No description provided.