Excel-ent
Description
excel-ent is a helper lib to export data in XLS and CSV.
Installation
$ yarn add @numpod/excel-ent
# or with npm
$ npm install @numpod/excel-ent --save
Using excel-ent
Two main functions exportmeExcel & exportmeToCsv
exportmeExcel
exportmeExcel(data: any[], title: string, options?: CSS.Properties)
Parameters
data
Required, must be an array of Object
title
Required, name of the archive generated
options
Optional, receives two attributes: bodyStyle and headerStyle
-
bodyStyle
andheaderStyle
: Both receives CSS Properties in camelCase and provide style for the header and body in the Excel File
Example
import { exportmeExcel } from "@numpod/excel-ent";
const data = [
{
id: 1,
name: 'Some Name',
age: 21,
},
{
id: 2,
name: 'Some New Name',
age: 23,
},
{
id: 3,
name: 'Some Name Again',
age: 22,
},
];
exportmeExcel(data, 'test', {
bodyStyle: { fontSize: '20px' },
headerStyle: { fontSize: '40px' },
});
Example output
exportmeToCsv
exportmeToCsv(data: any[], title: string)
Parameters
data
Required, must be an array of Object
title
Required, name of the archive generated
Example
import { exportmeToCsv } from "@numpod/excel-ent";
const data = [
{
id: 1,
name: "Some Name",
age: 21,
},
{
id: 2,
name: "Some New Name",
age: 23,
},
{
id: 3,
name: "Some Name Again",
age: 22,
},
];
exportmeToCSV(data, "MyReport");
Last fux
License
@numpod/excel-ent is MIT licensed.