Convert html to xlxs: numbers became date #772

Closed
opened 2017-08-09 04:32:30 +00:00 by sangpuion · 4 comments
sangpuion commented 2017-08-09 04:32:30 +00:00 (Migrated from github.com)

We are converting html table to xlxs/csv, for some data, the number became date.
For example, $41.08 was exported as "31-07-2041 4:00:00 PM"
Different combination of options have be tested:

var wopts = { bookType: type, bookSST: false, type: 'binary', raw: true, cellNF: true, cellDates : false, dateNF: 2},

Any suggestion?

We are converting html table to xlxs/csv, for some data, the number became date. For example, $41.08 was exported as "31-07-2041 4:00:00 PM" Different combination of options have be tested: var wopts = { bookType: type, bookSST: false, type: 'binary', raw: true, cellNF: true, cellDates : false, dateNF: 2}, Any suggestion?
SheetJSDev commented 2017-08-09 22:43:06 +00:00 (Migrated from github.com)

We are pushing a change in the next release so that currencies and thousands-separated numbers are properly recognized as numbers. IF you find any other strange cases, please let us know

We are pushing a change in the next release so that currencies and thousands-separated numbers are properly recognized as numbers. IF you find any other strange cases, please let us know
jyyan commented 2017-08-10 20:43:53 +00:00 (Migrated from github.com)

i also got a similar issue like this.

just found that in case UTF-8 encoded, one ore more chinese & japanese character/string combine with one space and one number ending (ex. "漢 1" or "漢漢漢漢 123" or "あ 1") in a HTML table cell (ex <td>あ 1</td> ), will cause output as xlsx format error as Date format (such like <c r="B2" s="1"><v>36892</v></c>)

but when i replace the space character in the HTML table with HTML special char &nbsp; (ex. "漢漢漢漢**&nbsp;**123") , it will export the right format as string cell.

i got the same issue in the demo table.

i also got a similar issue like this. just found that in case UTF-8 encoded, one ore more chinese & japanese character/string combine with one space and one number ending (ex. "漢 1" or "漢漢漢漢 123" or "あ 1") in a HTML table cell (ex `<td>あ 1</td>` ), will cause output as xlsx format error as Date format (such like `<c r="B2" s="1"><v>36892</v></c>`) but when i replace the space character in the HTML table with HTML special char **&amp;nbsp;** (ex. "漢漢漢漢**&amp;nbsp;**123") , it will export the right format as string cell. i got the same issue in the [demo table](http://sheetjs.com/demos/table.html).
SheetJSDev commented 2017-08-10 21:07:23 +00:00 (Migrated from github.com)

@jyyan that's coming from a combination of two problems:

  1. V8 date parsing is extremely robust. Try new Date("absolute nonsense 1") or new Date("漢 1") to see

  2. The original correction rejected dates if it contained English letters that weren't part of a month name. We're going to flip this to reject if any letters are detected.

@jyyan that's coming from a combination of two problems: 1) V8 date parsing is extremely robust. Try `new Date("absolute nonsense 1")` or `new Date("漢 1")` to see 2) The original correction rejected dates if it contained English letters that weren't part of a month name. We're going to flip this to reject if any letters are detected.
jyyan commented 2017-08-10 21:26:33 +00:00 (Migrated from github.com)

@SheetJSDev
thats right ! thanks for your help :P

@SheetJSDev thats right ! thanks for your help :P
Sign in to join this conversation.
No Milestone
No Assignees
1 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#772
No description provided.