Questions tagged [csv-parser]

44 questions
0
votes
0 answers

Axios stream does not 'await' when I process line by line

I need to read a csv file from an external location. Then I need to parse each line and insert them one by one in the DB. Once all is done, I need to do some other DB operations so I need to wait for the parsing/processing is done. But in my code…
Toba
  • 61
  • 1
  • 3
0
votes
0 answers

csv-parser fails when specifying start option in createReadStream

I'm dealing with large 1Gb csv file. I want to parse only a portion of the file, so I passed in the start and end options to createReadStream. When I do that, the csv-parser doesn't parse any rows. import { createReadStream } from 'fs'; import csv…
Pumpkin Pie
  • 510
  • 1
  • 4
  • 15
0
votes
1 answer

How can I read a csv file and store it in a txt file using specifically csv-parser

I have this csv file: country,year,population USA,1952,8425333 USA,1957,9240934 ... want to store it in a txt file: country,year,population USA,1952,8425333 USA,1957,9240934 ... This is an assignment for school and we are required to use…
MKOCH
  • 45
  • 1
  • 5
0
votes
1 answer

Having trouble with reading csv values for a specific column using csv-parser

I am writing an api where I am sending back some data after a get request is being made. I am reading the data from a CSV file and then just sending back the data of a specific column name. The columns I have available are [ 'YEAR', 'TICKETS…
trem98
  • 17
  • 8
0
votes
1 answer

How to group the data with Month and sum it using the Apache Common CSV with functional style?

The attached screenshot below is the output of the dataset. This is my homework and I have been required to do all the coding according to the functional programming style. I have try to use Java Stream and map to parse the date, but I have no idea…
mike kong
  • 47
  • 7
0
votes
1 answer

How to parse CSV correctly for Puppeteer to fill strings from CSV lines to text input on website?

I am trying to learn js/puppeteer and by building a simple web scraper to scrape books info for educational purposes. I am trying to get the web scraper to fill UPC numbers from a CSV file onto the search bar of a book website. I managed to get a…
Ben
  • 77
  • 9
0
votes
1 answer

How to do typecasting before parsing csv field to java object

I have a CSV file like below Rahul|S|74|72|71 Amrit|S|82|81|80 Akshay|S|82|89|81 And i want to map the fields to a java object. I am getting all the fields as String in the file. I am converting them to java object using opencsv like below My…
krishna
  • 343
  • 2
  • 5
  • 19
0
votes
0 answers

Best way to read buffer in node line by line

I am storing a file in memory using multer, the idea is to read the buffer and check the contents of the file line by line, the moment a line does not pass validation I want to discard otherwise save to disk. The file is a csv and I have tried…
Álvaro
  • 2,255
  • 1
  • 22
  • 48
0
votes
0 answers

Stop a readable stream when on data finds condition

I got a csv buffer that I am sending to a function. In the buffer I got this data: name,age tom,33 pal,22 tim,60 jon,12 I use a node stream that pipes it to an object with csv-parser and as I go I want to see if the condition is met, if we find tim…
Álvaro
  • 2,255
  • 1
  • 22
  • 48
0
votes
1 answer

Node csv-parser return variable

I have this function validarcsv(){ let text; fs.createReadStream('data.csv') .pipe(csv()) .on('data', (data) => results.push(data)) .on('end', () => { text = result[0].something return text; }); } and what i'm triyng to do is…
Juan Castillo
  • 103
  • 2
  • 9
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

Pandas csv parser not working properly when it encounters `"`

Problem statement: Initially what I had I have a CSV file with the below records:- data.csv:- id,age,name 3500300026,23,"rahul" 3500300163,45,"sunita" 3500320786,12,"patrick" 3500321074,41,"Viper" 3500321107,54,"Dawn Breaker" When I…
Pratap Alok Raj
  • 1,098
  • 10
  • 19
-1
votes
1 answer

Merge overlapping intervals in csv

I need to merge overlapping intervals in my CSV file. Here is the sample data I have Tasks Start End Read 10:00 12:00 Read 11:10 13:00 Read 13:50 14:00 Write 14:00 14:30 Write 11:00 15:00 The sample output should be like Read -…
-4
votes
1 answer

Is the first key of a csv table necessarily between quotes and therefore inaccessible?

I have a react project with nodejs mongodb and I use csvparser to transform data from a csv table into data in my database, I noticed that the first key of my table is necessarily between coast for example : fs.createReadStream(filePath) …
1 2
3