Questions tagged [node-csv-parse]

csv-parse is a parser for Node.js converting CSV text input into arrays or objects. It implements the stream API.

See npm page

73 questions
0
votes
1 answer

How to sequentially read a csv file with node.js (using stream API)

I am trying to figure out how to create a stream pipe which reads entries in a csv file on-demand. To do so, I thought of using the following approach using pipes (pseudocode) const stream_pipe = input_file_stream.pipe(csv_parser) // Then getting…
Michele
  • 2,148
  • 1
  • 9
  • 14
0
votes
2 answers

Adding Numbers from csv

I am trying to add all numbers from an column to an variable. The Problem is my code is adding the String to which results into NaN. var csvData=[]; let test = 0; var parser = parse({delimiter: ','}, function(err, data){ }); …
broking
  • 5
  • 2
0
votes
2 answers

Having trouble accessing particular key in object

I am using csv-parse in node.js (sync api) to parse a csv into a js object. Everything is working great except I'm having a lot of trouble accessing the first key value pair. If I console log the resulting object I get //object scorecard { …
lucai
  • 1
0
votes
1 answer

How can I get the data from the csv-parser?

I want to work with the data from a csv file and I have used csv-parser to do that. const csv = require('csv-parser') const fs = require('fs') const results: any[] = []; var value = fs.createReadStream('file.csv') .pipe(csv()) .on('data',…
0
votes
0 answers

How to take not valid lines from csv-file?

I use TinyCsvParser as tool to map lines from large csv-file into my data models. So, the question is how I can take not a valid lines to display it for user? Now it works with Regex, but I gonna re-write it on more readable tool. Is it…
binary robot
  • 83
  • 1
  • 4
0
votes
1 answer

nodeJS async function parse csv return data to other file

I'm creating a small tool for internal user with puppeteer. Basically I got a csv file with some data i "read" and fill form with. As I try to cleanup my project to be reusable i'm struggle a little bit: I create a file name parsecsv.js const…
Mitchum
  • 107
  • 2
  • 16
0
votes
0 answers

Mysql export CSV then parse in nodejs with csv-parse does not find separator properly

I am exporting a description field from a mysql db: SELECT REPLACE(description, char(13), '\\n') FROM table u INTO OUTFILE '/var/lib/mysql-files/u.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n'; Then in nodejs I process…
Vincent Teyssier
  • 2,146
  • 5
  • 25
  • 62
0
votes
1 answer

Execute Loop after ReadStream pipe has finished

Not sure if the Title is quite right in this as I'm pretty much stumped (in over my head)... I'm trying to pull the headers from a csv, as part of an automation test, to the validate those headers. I'm using csv-parse to read the csv file. Once I've…
Grubsniff
  • 25
  • 4
0
votes
0 answers

Node.js: CSV displays correctly on mac os(numbers) but displays all messed up on windows(excel)

I am generating a few csv files, the generating works well but when i open the file in Excel it displays all messed up, however the same file opens well in mac(numbers) below is the relevant part of the code i am using to generate the files.…
opensource-developer
  • 2,826
  • 4
  • 38
  • 88
0
votes
0 answers

problem : ENOENT error through the cdv file exists in TYPEscript

I need help, in typescript I am trying to read a cdv file in the same folder but I have an enoent error import csv from 'csv-parser' import fs from 'fs' let results = new Array(); function LoadCSV(file: fs.PathLike){ …
0
votes
1 answer

Processing a csv file with unequal amount of columns in nodes

I have the following function which processes my csv file. Unfortunately the csv file has one column where it also uses the comma as thousand separator (I have no influence over this exported csv file and its structure). So in every file from a…
Niels Hop
  • 11
  • 1
0
votes
1 answer

How to use csv-parser to loop over rows in nodejs?

I am trying to write a script that will help me spit out boring code for work. So at times, I get a .csv file that instructs me to create table fields, sometimes up to 50 at once! (Using AL, a Business Central programming language.) I tried writing…
mysamza
  • 387
  • 1
  • 6
  • 22
0
votes
1 answer

Parsing CSV in NodeJS by last comma only

My team is trying to take questions by developers in a CSV and parse it to put into a database. Some developers have commas in their questions. The format of the CSV is Question,Answer. For example, a row might be `Hi, how are you,good' or 'what is…
0
votes
1 answer

Huge CSV data to display in ChartJS

I have a CSV file with data like this - time,a,b,c,d,e,f,g 2020-06-18 14:59:34.585143,2,0,0,2,1,1,0 2020-06-18 14:59:38.302183,2,0,0,2,1,0,1 .. .. 2020-06-18 15:04:11.529016,1,0,0,1,0,0,0 2020-06-18 15:04:11.874480,1,0,0,1,0,0,0 2020-06-18…
Vibhor Dube
  • 4,173
  • 1
  • 22
  • 32
0
votes
1 answer

CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE csv parse for node?

I'm using a 3rd party application that throws this error: Error: Invalid Closing Quote: found non trimable byte after quote at line 5 code: CSV_NON_TRIMABLE_CHAR_AFTER_CLOSING_QUOTE column: 16 empty_lines: …
sam
  • 653
  • 9
  • 21