PapaParse icon indicating copy to clipboard operation
PapaParse copied to clipboard

Error loading the content of csv file in react-native

Open alaaag opened this issue 4 years ago • 1 comments

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);
    
    }
    
  })
);

alaaag avatar Apr 14 '20 09:04 alaaag

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.

nicolas-costa avatar Jun 04 '20 13:06 nicolas-costa