u/Existing_Forever_425

[npm] html-to-xlsx-styled — export HTML tables to styled Excel (.xlsx) with merges and CSS
▲ 1 r/npm

[npm] html-to-xlsx-styled — export HTML tables to styled Excel (.xlsx) with merges and CSS

I published a small library for a common pain: you have a styled HTML table (classes, computed CSS, merged cells) and need a real .xlsx that still looks like the page.

html-to-xlsx-styled takes a HTMLTableElement and outputs Excel via xlsx-js-style:

  • Background / font / borders from computed styles
  • rowspan / colspan → Excel merges
  • Optional preservation of styled empty cells
  • Browser: Blob + one-click download; Node: use with jsdom

​

npm install html-to-xlsx-styled

import { exportHtmlTableToExcel } from 'html-to-xlsx-styled';

exportHtmlTableToExcel(document.querySelector('table'), {
  download: true,
  fileName: 'export.xlsx',
});

npm: https://www.npmjs.com/package/html-to-xlsx-styled

Happy to hear edge cases you hit — especially weird tables or CSS.

u/Existing_Forever_425 — 23 days ago