Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Add Condition on <ExcelSheet> for condition base export of sheet tab #160

Open
codal-mitalt opened this issue Jul 9, 2021 · 1 comment

Comments

@codal-mitalt
Copy link

codal-mitalt commented Jul 9, 2021

Version- "react-export-excel": "^0.5.3",

I am using This Library to Export in Excel With Multiple Tabs

below is working fine

                        <ExcelFile filename="Activity History" className="btn lg-btn">Export CSV</button>}>
                                    <ExcelSheet data={D1Array} name="New>
                                        <ExcelColumn label="Last Updated By" value="last_updated_by" />
                                        <ExcelColumn label="Last Updated At" value="last_updated_at" />
                                    </ExcelSheet>

                                    <ExcelSheet data={D2Array} name="Current">
                                        <ExcelColumn label="Last Updated By" value="last_updated_by" />
                                        <ExcelColumn label="Last Updated At" value="last_updated_at" />
                                 </ExcelSheet>
                        </ExcelFile>

but If I am using

                <ExcelFile filename="Activity History" className="btn lg-btn">Export CSV</button>}>
                                    
                                    {D1Array &&
                                        <ExcelSheet data={D1Array} name="New>
                                        <ExcelColumn label="Last Updated By" value="last_updated_by" />
                                        <ExcelColumn label="Last Updated At" value="last_updated_at" />
                                    </ExcelSheet>
                                    }
                                    <ExcelSheet data={D2Array} name="Current">
                                        <ExcelColumn label="Last Updated By" value="last_updated_by" />
                                        <ExcelColumn label="Last Updated At" value="last_updated_at" />
                                 </ExcelSheet>
                        </ExcelFile>

It throws an Error

TypeError: Cannot read property 'props' of null
(anonymous function)
C:/syzygy/syzgy-front-final/frontend/node_modules/react-export-excel/dist/ExcelPlugin/components/ExcelFile.js:131

Any Suggestions how to achieve this?

@molimat
Copy link

molimat commented Oct 5, 2021

I would suggest to create two different export components and create a condition on parent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants