Problem with reading non-en-US numbers from HTML file #3227

Closed
opened 2024-09-24 15:08:45 +00:00 by angelomaria · 3 comments

If I try to read numbers that end in 0, the library deletes all the “0” at the end of the number.
For example if I have 10,000 in the excel file, it reads 10, if I have 23,980 instead it reads 23,98

If I try to read numbers that end in 0, the library deletes all the “0” at the end of the number. For example if I have 10,000 in the excel file, it reads 10, if I have 23,980 instead it reads 23,98
Owner

Can you share a sample file?

Under the hood, SheetJS uses en-US locale settings: , is the thousands separator and . is the decimal point. If you are in a locale that uses different settings, the plaintext parsers may misinterpret values.

Can you share a sample file? Under the hood, SheetJS uses en-US locale settings: `,` is the thousands separator and `.` is the decimal point. If you are in a locale that uses different settings, the plaintext parsers may misinterpret values.
Author

Hello,
this is the example of excel file that is generated by other management software I have.

Greetings,

Hello, this is the example of excel file that is generated by other management software I have. Greetings,
Owner

Thanks for sharing!

Your "XLS" file is really a HTML table. The TD elements are parsed using JS built-in features, which assume en-US interpretation. For example:

<td  class="olo-tot olo-tot_11975958 olo-border-right-3"  >10.000</td>

This is probably the value 10000 (1.0e+4).

If you have control over the HTML generation, use the data- overrides to specify the true value and the desired number format.

The general problem is tracked in issue #3180

Thanks for sharing! Your "XLS" file is really a HTML table. The TD elements are parsed using JS built-in features, which assume en-US interpretation. For example: ```html <td class="olo-tot olo-tot_11975958 olo-border-right-3" >10.000</td> ``` This is probably the value `10000` (`1.0e+4`). If you have control over the HTML generation, [use the `data-` overrides](https://docs.sheetjs.com/docs/api/utilities/html#value-override) to specify the true value and the desired number format. The general problem is tracked in issue #3180
sheetjs changed title from Problem with reading numbers from excel file to Problem with reading non-en-US numbers from HTML file 2024-10-05 16:09:05 +00:00
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#3227
No description provided.