Skip to content

Instantly share code, notes, and snippets.

@adilsoncarvalho
Created May 27, 2018 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adilsoncarvalho/e10476b853187b441b83e6635d0f701b to your computer and use it in GitHub Desktop.
Save adilsoncarvalho/e10476b853187b441b83e6635d0f701b to your computer and use it in GitHub Desktop.
Creating a xlsx file using the package xlsx
// More at: https://github.com/SheetJS/js-xlsx/blob/master/demos/server/express.js
import XLSX from 'xlsx';
// create a new workbook
const workbook = XLSX.utils.book_new();
// create a new worksheet
const worksheet = XSLX.utils.json_to_sheet([{ a: 1, b: false }]);
// add the worksheet to the workbook
XLSX.utils.book_append_sheet(workbook, worksheet, 'Teretete');
// write it down
XLSX.writeFile(workbook, 'out.xlsx');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment