
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
react-csv-reader
Advanced tools
React component that handles csv file input.
It handles file input and returns its content as a matrix.
You can try it out in a demo on Codesandbox.
Install the package with either yarn or npm.
With yarn:
yarn add react-csv-reader
With npm:
npm install --save react-csv-reader
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import CSVReader from 'react-csv-reader'
class App extends Component {
...
render() {
return (
<CSVReader
cssClass="csv-reader-input"
label="Select CSV with secret Death Star statistics"
onFileLoaded={this.handleForce}
onError={this.handleDarkSideForce}
inputId="ObiWan"
inputStyle={{color: 'red'}}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('root'))
| Name | Type | Default | Description |
|---|---|---|---|
| cssClass | string | csv-reader-input | A CSS class to be applied to the wrapper element. |
| cssInputClass | string | csv-input | A CSS class to be applied to the <input> element. |
| label | string, element | If present, it will be rendered in a <label> to describe input aim. | |
| onFileLoaded | function | (required) The function to be called passing loaded results. | |
| onError | function | Error handling function. | |
| parserOptions | object | {} | PapaParse configuration object override |
| inputId | string | An id to be applied to the <input> element. | |
| inputStyle | object | {} | Some style to be applied to the <input> element. |
When the file has been loaded, it will be parsed with PapaParse from a CSV formatted text to a matrix.
That matrix is returned to the parent component with onFileLoaded function (it will be passed as an argument).
The second argument to onFileLoaded will be the filename provided
FAQs
React component that handles csv file input.
The npm package react-csv-reader receives a total of 45,621 weekly downloads. As such, react-csv-reader popularity was classified as popular.
We found that react-csv-reader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.