简体   繁体   中英

Trying to export data to excel file without jquery

Im trying to export the data i have into an excel file without jquery. I've read you can use javascript but most example have jquery. The reason i don't want to use jquery is that the project is build with react.

I already have the data from the database, so i don't need to bring it again. I want to take that data and make it into an excel file. little bit of the code below.

<li className='col-md-3 col-height col-middle'>
<span>{fromTime}</span> //contains data
</li>

Some example use table, is it possible to export from

<div>
<li>
<span>

Would appreciate any tips, example or anything

The most common way to export data into excel would be to covert it into a csv (comma seperated values) file which can then be opened in excel. There are plenty of tutorials on how to do this, there are many different ways with a simple google. In your case doing this in php will likely be best because your getting it from a database.

SheetJS seems perfect for this.

To export your table as an excel file use the code in this link(along with SheetJS)

Just plug in your table element's id into export_table_to_excel

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