Skip to content

Instantly share code, notes, and snippets.

@manniru
Created September 20, 2022 05:17
Show Gist options
  • Save manniru/5b1b819e1fb6b5f5139a76dfc4b07c78 to your computer and use it in GitHub Desktop.
Save manniru/5b1b819e1fb6b5f5139a76dfc4b07c78 to your computer and use it in GitHub Desktop.
const XLSX = require('xlsx');const data = [
{ name: 'Diary', code: 'diary_code', author: 'Pagorn' },
{ name: 'Note', code: 'note_code', author: 'Pagorn' },
{ name: 'Medium', code: 'medium_code', author: 'Pagorn' },
]const workSheet = XLSX.utils.json_to_sheet(data);
const workBook = XLSX.utils.book_new();XLSX.utils.book_append_sheet(workBook, workSheet, "Sheet 1");
XLSX.writeFile(workBook, "./temp/sample.xlsx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment