PapaParse
PapaParse copied to clipboard
Error loading the content of csv file in react-native
i Tried to using papaparse in react-native , but i got an illogocal result , in spent of display the content of csv file , i got in the result the url path of file as a string .. any help ?
this is the code :
async chooseFile () {
try {
const res = await DocumentPicker.pick({
type: [DocumentPicker.types.allFiles],
});
var RNGRP = require('react-native-get-real-path');
RNGRP.getRealPathFromURI(res.uri).then(filePath =>
Papa.parse(filePath, {
complete: function(results) {
console.log("Row:", results.data);
}
})
);
I am trying to make the same thing here. AFAIK, Papa.parse expects a csv string, remote url string or file object, what you are getting is a local url, maybe that's why it's not working.
I'm trying to work it out, and I will be back here if I get any success.