Xlsx

XLSX

Description

what is it ? : utility library to export data to Excel format.
URL : official NPM Repository (opens in a new tab)
version : 0.18.5
Why ? :

  • Lightweight and simple .
  • Offers both CSV and Excel Exports

Application

example :

// let's import the library
import * as XLSX from 'xlsx';
data = [
  {
    firstName: 'John',
    lastName: 'Doe',
  },
  {
    firstName: 'Alice',
    lastName: 'Lee',
  },
];
// create a sheet
const ws = XLSX.utils.json_to_sheet(data);
// create workbook
const wb = XLSX.utils.book_new();
// add the sheet to the workbook
XLSX.utils.book_append_sheet(wb, ws, 'Responses');
// generate the file
XLSX.writeFile(wb, 'sampleData.export.xlsx');