Home > other >  How to export table after sorting in React?
How to export table after sorting in React?

Time:11-09

I want to sort when I click on names in that order i want to download csv e.g-Afzar,Babar,Himanshu after sorting Himanshu,Babar,Afzar in this order I want to export csv in react{Any packages or link availiable pls share}

CodePudding user response:

This package react-native-csv looks cool to handle csv in react-native and this package react-csv to handle csv in react.

CodePudding user response:

you can use for excel export something like this :

npm install xlsx-style --save
npm install react-data-export --save

in return

const dataSet2 = [
  {
    name: "Johnson",
    total: 25,
    remainig: 16,
  },
  {
    name: "Josef",
    total: 25,
    remainig: 7,
  },
];
function ExcelSuccessReserve() {
  return (
    <ExcelFile>
  
      <ExcelSheet data={dataSet2} name="Leaves">
        <ExcelColumn label="Name" value="name" />
        <ExcelColumn label="Total Leaves" value="total" />
        <ExcelColumn label="Remaining Leaves" value="remaining" />
      </ExcelSheet>
    </ExcelFile>
  );
  • Related