Hello everyone I have use papaparse library for read csv data it's working fine . But I have face a issue how to read multiple files.
Check the below code this may help you.
$(document).ready(function() { var files = ['file1.csv', 'file2.csv', 'file3.csv']; var results = []; function readFile(index) { if (index >= files.length) { // All files have been processed console.log(results); return; } $.ajax({ type: 'GET', url: files[index], dataType: 'text', success: function(data) { var csvData = Papa.parse(data).data; results.push(csvData); readFile(index + 1); } }); } readFile(0); });
var files = Directory.EnumerateFiles("path", "*.csv"); foreach (string file in files) { using (FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read)) { // Use the file stream to read data. } }
could you please refer this link
https://medium.com/@kishanvikani/parse-multiple-files-using-papa-parse-and-perform-some-synchronous-task-2db18e531ede