I'm trying to upload a file with the format of .csv/.xls/.xlsx
and then read the file contents.
For example the following file
would output:
name,age,key
Mark,25,1
Jones,30,2
This is what I've implemented so far using react-file-reader and base-62 but it only works for the .csv
files:
onFileUpload(file) {
var decodedData = base64.decode(file.base64);
}
<ReactFileReader fileTypes={[".csv",".xls", ".xlsx"]} base64={true} multipleFiles={false} handleFiles={this.onFileUpload}>
<button className='btn'>Upload</button>
</ReactFileReader>
Is there any way I can get the content of .xls
and .xlsx
files using the same way as I did for .csv
files? Or maybe another module that does this...