I'm trying to parse a local file with PapaParse but the console returns undefined. Also, if I comment out the download:true
the console returns an empty array. Is there something wrong with the way I'm passing the local file as an argument because in an async code Papa.parse('./Clean.csv',{})
works
const parseData = (content) => {
let data;
return new Promise((resolve) => {
Papa.parse(content, {
header: true,
download: true,
delimiter: ',',
dynamicTyping: true,
complete: (results) => {
data = results.data;
}
});
resolve(data);
});
};
parseData('./Clean.csv')
.then(results => console.log(results));