json2xlsx-ws
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

json2xlsx-ws NPM version

Converts object arrays to xlsx worksheets

yarn add json2xlsx-ws

Usage

import { json2xlsx } from "json2xlsx-ws";
import * xslx from "xlsx";

// Headers are generated from the first object in the data array
const data = [
  {
    number: "number",
    string: "string",
    date: "date",
  },
  {
    number: 1,
    string: "string1",
    date: Date(),
  },
  {
    number: 2,
    string: "string2",
    date: Date(),
  },
];

xlsx.writeFile(
  {
    SheetNames: ["Sheet1", "Sheet2"],
    Sheets: {
      Sheet1: json2xlsx(data),
      Sheet2: json2xlsx(data),
    },
  },
  "workbook.xlsx"
);

Contributing

I'd love for you to contribute and make json2xlsx-ws even better than it is today!

Getting started

git clone https://github.com/Zertz/json2xlsx-ws.git
yarn
yarn test

Package Sidebar

Install

npm i json2xlsx-ws

Weekly Downloads

860

Version

1.0.1

License

MIT

Unpacked Size

20.4 kB

Total Files

15

Last publish

Collaborators

  • zertz