1.1.1 • Published 4 years ago

@shujo/excel-export v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

export-excel

A simple node module for exporting data set to excel file or excel buffer.

Install

npm i @shujo/export-excel --save 

Usage

const { generateExcelFile, generateExcelBuffer } = require('@shujo/export-excel')
//or
import { generateExcelFile, generateExcelBuffer } from '@shujo/export-excel'

Generate Excel File

import { generateExcelFile } from '@shujo/export-excel'

(async() => {
    try{
        const options = {
            filename: "sample-filename"
            sheet: "Sheet1",
            columns: [
                { header: "ID" , key: "id", width: 10 },
                { header: "Name" , key: "id", width: 10 }
            ],
            rows: [
                { id: 1, name: "Foo" },
                { id: 2, name: "Bar" },
            ]
        }
        await generateExcelFile(options);
    }catch(error){
        console.log(error);
    }
})

Generate Excel Buffer

import { generateExcelBuffer } from '@shujo/export-excel'

(async() => {
    try{
        const options = {
            sheet: "Sheet1",
            columns: [
                { key: "id", header: "ID", width: 10 },
                { key: "name", header: "Name", width: 10 }
            ],
            rows: [
                { id: 1, name: "Foo" },
                { id: 2, name: "Bar" },
            ]
        }
        let bufferData = await generateExcelBuffer(options);
        console.log(bufferData);
    }catch(error){
        console.log(error);
    }
})
1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago