excel_exporter

1.0.7 • Public • Published

Simple use

var excel_exporter = require('excel_exporter');

excel_exporter.export(datas, title, options, data_ref, res);

  • Where datas is an array that contents each data in the excel rows.
  • title is a string and is the file name of your .xlsx.
  • options specifies some export options.
  • data_ref selects and locates items in each element of the ** datas **, and gives name to each column of items.
  • res is the respond Object when using HTTP module in Node.js.

Installation

$ npm install excel_exporter

Options

  • headless : do not generate header with data_ref

Data_ref

data_ref contents the items that you want to export in your .xlsx file, and looks like below:

[
	{
      "map_value": "",
      "map_type": "order",
      "map_key": "Order"
    },
    {
      "map_value": "company_name",
      "map_type": "normal",
      "map_key": "Company"
    },
    {
      "map_value": "creator_nickname",
      "map_type": "normal",
      "map_key": "Creater"
    },
    {
      "map_value": ["created","modified"],
      "map_type": "normal",
      "map_key": "Created at/ Updated at"
    }
]
  • map_value : is the referance in each element in your datas array, can be "" when map_type is "order". When map_type is "combine", map_value should be of Array type.
  • map_type : describes how this column data is formed, can be "order", "normal" or "combine".
  • map_key : is the name that you give to this column, affects headers.

Readme

Keywords

Package Sidebar

Install

npm i excel_exporter

Weekly Downloads

1

Version

1.0.7

License

MIT

Last publish

Collaborators

  • samicelus