简体   繁体   中英

Is there any way/working libraries to export my React Table to downloadable excel sheet (xls or xlsx, csv will not work) - React

This is my Demo in CodeSandbox - https://codesandbox.io/s/2wp7jk23kr

If possible, you can kindly fork/modify to show how to introduce this feature to my table.

Yes you can use react-data-export library. Just give your table dataset to library. Here is an example:

<ExcelFile element={<button className="btn btn-primary">Download Excel</button>}>
                <ExcelSheet data={this.props.dataSet} name="Employees">
                    <ExcelColumn label="#" value="sira"/>
                    <ExcelColumn label="Sicil" value="userID"/>
                    <ExcelColumn label="T.C. Kimlik No" value="tcKimlikNo"/>
                    <ExcelColumn label="Adı" value="ad"/>
                    <ExcelColumn label="Soyadı" value="soyad"/>
                    <ExcelColumn label="Klavye Türü" value="klavyeTur"/>
                </ExcelSheet>
            </ExcelFile>

Chech the details from here: https://www.npmjs.com/package/react-data-export

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM