italia/daf-dataportal-public

How to show the imported csv data into table using reactjs?

Closed this issue · 1 comments

I have an upload button to import only CSV files to my Reactjs application. I can successfully upload the data(CSV) using React file reader but now I want to show the CSV data it into a table. I think this could help me but I cannot understand how to use it https://github.com/marudhupandiyang/react-csv-to-table here. Below is my code:

import React, { Component } from 'react';
import ReactFileReader from 'react-file-reader';
import { CsvToHtmlTable } from 'react-csv-to-table';
import './App.css';

class App extends Component {

handleFiles = files => {
var reader = new FileReader();
reader.onload = function(e) {
// Use reader.result
alert(reader.result);
}
reader.readAsText(files[0]);
}

render() {
return (


<ReactFileReader handleFiles={this.handleFiles} fileTypes={'.csv'}>
Upload


);
}
}

export default App;

please help. It's very important to me.

This repo is now deprecated, issue closed.