First row's header quoted
See original GitHub issue- Operating System: Docker node:8-slim
- Node Version: 8.16
- NPM Version: 6.4.1
- csv-parser Version: 2.3.0
Expected Behavior
Data of
col1,col2,col3
a,2,foobar
becomes:
[
Row {
col1: 'a',
col2: '2',
col3: 'foobar'
}
]
Actual Behavior
[
Row {
'col1': 'a',
col2: '2',
col3: 'foobar'
}
]
Notice how the first column’s header has a single quote around it: 'col1'
.
How Do We Reproduce?
File was created from Excel (using 16.24 via Office 365 subs). File has been checked with text editor and confirmed does not have a quote around the first column’s header.
Code
const csv = require('csv-parser')
const fs = require('fs')
const results = [];
fs.createReadStream('test-csv-parser.csv')
.pipe(csv())
.on('data', (data) => results.push(data))
.on('end', () => {
console.log(results);
});
This may be related with #127 .
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Write quotes round all fields except first (heading) row
QuoteNoFields = true; cw.WriteHeader<YourClassNameHere>(); cw.NextRecord(); // without this first row is on same line as header cw.Configuration ...
Read more >quotes around column headings in CSV file
When I save my CSV file, quotes are put around all text values, even the column headings / field names. Then when I...
Read more >Quote Line Editor column headings - IdeaExchange - Salesforce
The column headings in the Quote Line Editor disappear as you scroll down. It would be extremely useful and productive to have these...
Read more >Column names in header row have quotes - MSDN - Microsoft
I figured out how to get the string/text data surrounded by double-quotes, but the setting also quotes the column names in the header...
Read more >how to eliminate double quotes for column headers in ...
I don't think it should double quote the header part. yes it is exactly double quotes (because when i clear the Columns name...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For future people stumbling on my comment. https://github.com/mafintosh/csv-parser#byte-order-marks documents the issue well and contains a solution.
@daytonmills I discovered that this issue can be reproduced by simply setting the encoding to UTF-8-BOM within notepad++. This is also the format that excel uses when saving csv files by default. A workaround is to manually change the encoding to UTF-8.