nzambello / react-csv-reader

React component that handles csv file input and its parsing
https://nzambello.github.io/react-csv-reader/
MIT License
199 stars 48 forks source link

[Problem]parserOptions is not woking #12

Closed Vbubblery closed 4 years ago

Vbubblery commented 5 years ago

Hello,

I wanna use parserOptions to make the header as true, but it's not working. Can you give an example to show me how to handle it?

I try to parse 2 rows of the csv, but it also gives me all of them.

<CSVReader
      cssClass="react-csv-input"
      label="Select CSV with secret Death Star statistics"
      onFileLoaded={handleForce}
      parserOptions={{
        preview: 2
      }}
    />
Vbubblery commented 5 years ago

NVM this problem,

It's not working in your demo, but it's working in the own project.

nzambello commented 5 years ago

Hi @Vbubblery, so if I understood correctly the argument for PapaParse options is passed correctly on your project but not in the demo on codesandbox, isn't it?

I tested and I can confirm that, but I don't know why it should be different 🤔

frankf-cgn commented 5 years ago

The reason is that the demo on codesandbox defaults to react-csv-reader version 0.2.1. If you change the version to 1.2.2 in the first column, dependency on the Codesandbox page, it works for me.