Reading data from html generated xls tables #929

Closed
opened 2017-12-25 01:37:31 +00:00 by Irikos · 3 comments
Irikos commented 2017-12-25 01:37:31 +00:00 (Migrated from github.com)

Hello,

Is there any way to read the data from html generated tables, when the data in the td is separated on multiple lines using <br />?
From my tests so far it is only possible to read the first row.

Of course I could use jquery for that but was wondering since if there isn't a solution maybe I can try and implement one, for cases when you cannot know upfront how the xls(x) file was created

All the best!

Hello, Is there any way to read the data from html generated tables, when the data in the td is separated on multiple lines using `<br />`? From my tests so far it is only possible to read the first row. Of course I could use jquery for that but was wondering since if there isn't a solution maybe I can try and implement one, for cases when you cannot know upfront how the xls(x) file was created All the best!
SheetJSDev commented 2017-12-25 02:42:43 +00:00 (Migrated from github.com)

The issue can be reproduced:

var table = "<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>";
var wb = XLSX.read(table, {type:"string"});
console.log(wb.Sheets.Sheet1.A1.v); // should be "foo\nbar"

The most recent commit resolves it. Once the CI tests pass we'll push to npm

The issue can be reproduced: ```js var table = "<table><tr><td>foo<br/>bar</td><td>baz</td></tr></table>"; var wb = XLSX.read(table, {type:"string"}); console.log(wb.Sheets.Sheet1.A1.v); // should be "foo\nbar" ``` The most recent commit resolves it. Once the CI tests pass we'll push to npm
Irikos commented 2017-12-25 03:06:30 +00:00 (Migrated from github.com)

Great, thanks!

Also, while we're at it, XLSX.read only starts reading from the <table> tag. Any information that was placed before that is not accessible (although visible in .xls)

Great, thanks! Also, while we're at it, XLSX.read only starts reading from the `<table>` tag. Any information that was placed before that is not accessible (although visible in .xls)
Irikos commented 2017-12-25 21:22:26 +00:00 (Migrated from github.com)

Works like a charm now.

Works like a charm now.
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#929
No description provided.