Skip to content

Make a spreadsheet, you say? Style it nicely and use a pre-existing template too? All in node.js/io.js? Yessir!

License

Notifications You must be signed in to change notification settings

aaronmccall/excellent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

excellent

excellent takes the pain out of generating Excel (xlsx) spreadsheets in Javascript.

example

var excellent = require('excellent');
var fs = require('fs');
var dkGreyBorder = {style: 'thin', color: 'Charcoal Gray'};
var doc = excellent.create({
    sheets: {
        'Summary': {
            image: {image: fs.readFileSync(__dirname + '/assets/dog.png'), filename: 'dog.png'},
            rows: [{
                cells: [
                    'foo',
                    {value: 'bar', style: 'bold'},
                    {value: 'foo', style: 'lemonBg'},
                    'baz',
                    {value: 'quux', style: 'lemonBgBold'}
                ]
            }, {
                cells: ['', {value: 'WAT?!', style: 'brick'}, {value: 'dotty', style: 'dotty'}]
            }]
        }
    },
    styles: {
        borders: [{label: 'dkGrey', left: dkGreyBorder, right: dkGreyBorder, top: dkGreyBorder, bottom: dkGreyBorder}],
        fonts: [{label: 'bold', bold: true}, {label: 'brick', color: 'Brick Red'}],
        fills: [{label: 'lemon', type: 'pattern', color: 'Lemon Glacier'}],
        cellStyles: [
            {label: 'bold', font: 'bold'},
            {label: 'brick', font: 'brick', border: 'dkGrey'},
            {label: 'lemonBg', fill: 'lemon'},
            {label: 'lemonBgBold', font: 'bold', fill: 'lemon'},
            {label: 'dotty', fill: 1}
        ]
    }
});

fs.writeFileSync(__dirname + '/test.xlsx', doc.file);

The result: image of generated spreadsheet

About

Make a spreadsheet, you say? Style it nicely and use a pre-existing template too? All in node.js/io.js? Yessir!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •