node-sheet
TypeScript icon, indicating that this package has built-in type declarations

0.3.1-beta • Public • Published

NODE-SHEET (beta)

GitHub repo size GitHub language count GitHub forks Bitbucket open issues

A simple way to create spreadsheets.

Disclaimer

It is not recommended to use this library in real projects.

Installing node-sheet

Use one of the commands below to install the node-sheet:

npm install node-sheet
yarn add node-sheet
pnpm add node-sheet

Using node-sheet

Class Description
Workbook Main class that manages the worksheet
Worksheet Class that manages each sheet page
Column Class used to build each column of the worksheet
Header Class used to add the headers of each column that is able to define patterns for all the cells of the column
Cell Class used to insert rows to the column

Here's how you can create a basic spreadsheet containing name, age and gender:

const { Worksheet, Column, Header, Cell, Workbook } = require('node-sheet');

const worksheet = new Worksheet('Page 1');  // Page 1 is the page name

worksheet.addColumns([
  new Column({
    header: new Header({ title: 'Name' }),
    cells: [new Cell('John'), new Cell('Maria'), new Cell('Joseph')],
  }),
  new Column({
    header: new Header({ title: 'Age' }),
    cells: [new Cell(20), new Cell(30), new Cell(40)],
  }),
  new Column({
    header: new Header({ title: 'Gender' }),
    cells: [new Cell('Male'), new Cell('Female'), new Cell('Male')],
  }),
]);

new Workbook().addWorksheet(worksheet).export('worksheet-name');

Pay attention: the cells will be organized according to the order they are arranged in cells.

the export method will create a sheet at the root named according to the string passed by parameter. The result will be a spreadsheet like this:

Name Age Gender
John 20 Male
Maria 30 Female
Joseph 40 Male

Readme

Keywords

Package Sidebar

Install

npm i node-sheet

Weekly Downloads

1

Version

0.3.1-beta

License

ISC

Unpacked Size

21.3 kB

Total Files

38

Last publish

Collaborators

  • opedro3g