8000
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When my cell value included a comma (','), the row value I got inside 'data' event handler callback was truncated at the point of the comma, and was suffixed with a double quote sign ('"').
So, for example, a value of abcd, efg would result in abcd".
@nirarazi@sureshvarman@jschultz21 the csv-stream module defaults to no field enclosure character. Characters like " are treated as literal, so the parser sees a CSV line like
"abc,def","ghi,jkl"
as 4 separate fields.
According to the docs, the fix is to pass the option enclosedChar:'"' to csv-stream.
Since excel-stream largely passes options directly to csv-stream, the simplest fix is to pass an options argument to excel-stream with the enclosedChar:'"' field. For example, if the excel file is:
Activity
sureshvarman commentedon Sep 19, 2016
+1
sureshvarman commentedon Sep 19, 2016
adding delimiter to the options solves the issue
jschultz21 commentedon Feb 8, 2017
hi! I'm having a hard time with this, as well. For an xlsx file, what should the delimiter be, if not a comma?
reviewher commentedon Feb 8, 2017
@nirarazi @sureshvarman @jschultz21 the csv-stream module defaults to no field enclosure character. Characters like
"are treated as literal, so the parser sees a CSV line likeas 4 separate fields.
According to the docs, the fix is to pass the option
enclosedChar:'"'to csv-stream.Since excel-stream largely passes options directly to csv-stream, the simplest fix is to pass an options argument to excel-stream with the
enclosedChar:'"'field. For example, if the excel file is:then call:
replace console.log with your normal callback function and replace the fs.createReadStream part with however you are getting the data.
jschultz21 commentedon Feb 8, 2017
thank you @reviewher, this worked perfectly!
11et401012 commentedon Nov 28, 2017
thank you @reviewher, this worked .