securedeveloper / react-data-export

Export dataset in react.
https://securedeveloper.github.io/react-data-export/
MIT License
179 stars 194 forks source link

TypeError: Cannot read property 'name' of undefined at ExcelFile.js:89 #128

Closed Lord-Mendoza closed 4 years ago

Lord-Mendoza commented 4 years ago

My reason:

For some reason as I'm debugging the code I see that it's trying to retrieve the SheetNames, but in the way that it's doing it sheet is getting passed in as " " and so when sheet.props is called its returning an error. I tried to specify the sheet name inside the ExcelSheet to no avail.

Steps to reproduce:

Setup some exportData variable with the same configuration as shown in the code sample that shows styled export. I'm including the following on my render: <ExcelFile hideElement={true} filename={"export"}>

Lib Version: 0.6.0

lowzijian commented 4 years ago

@Lord-Mendoza what is the error ? Im also facing the same issue

Lord-Mendoza commented 4 years ago

For me I found out that between your ExcelFile and ExcelSheet declaration you just need to make sure to not leave any spaces in between. There's code in the ExcelFile.js where it would read the name property, and those spaces it was trying to read but obviously would throw an error. So for example instead of doing:

ExcelFile> ExcelSheet> /ExcelFile>

Make sure it's tight like: ExcelFile>ExcelSheet>/ExcelFile>

(not sure why github hides the code, but the left < brackets should be there)