I am reading a csv file in javascript using the code:
import csv
file = open(r'C:\Users\hu170f\Documents\TEST1\MAAP-S12_LH_UP_PASS-LN1-V1.csv')
csvreader = csv.reader(file)
Now I have multiple files in the same directory and I need to read all the files present in the directory sequentially in a for loop. How to proceed with this.
First of all, install and require all the dependencies. Example:
var fs = require('fs');
const path = require('path');
const mysqlConnection = require('./connection');
const fastcsv = require('fast-csv');
Loop through each CSV file argument and run the formatFile function on each
for (let i = 0; i < filePaths.length; i++) {
formatFile(filePaths, i);
}