Uploading and reading CSV files
Many packages are available which reads the react.js files but they don't seal with CSV files. The data must be parsed in a readable format. A react file reader and HTML reader can be used to render the file.
<ReactFileReader handleFiles={this.handleFiles} fileTypes={'.csv'}>
<button className='btn'>Upload</button>
</ReactFileReader>
handleFiles = files => {
var reader = new FileReader();
reader.onload = function(e) {
// Use reader.result
alert(reader.result)
}
reader.readAsText(files[0]);
}
If FileReader is not working, use window.FileReader.
Comments
0 comments
Please Sign in or Create an account to Post Comments