Skip to content

Instantly share code, notes, and snippets.

@nealrs
Created April 13, 2016 01:43
Show Gist options
  • Save nealrs/4bdcb6316665338d9a1f7c2b690d6a19 to your computer and use it in GitHub Desktop.
Save nealrs/4bdcb6316665338d9a1f7c2b690d6a19 to your computer and use it in GitHub Desktop.
ExcelJS demo for Git@Me
var Excel = require('exceljs');
// create workbook & add worksheet
var workbook = new Excel.Workbook();
var worksheet = workbook.addWorksheet('Discography');
// add column headers
worksheet.columns = [
{ header: 'Album', key: 'album'},
{ header: 'Year', key: 'year'}
];
// add row using keys
worksheet.addRow({album: "Taylor Swift", year: 2006});
// add rows the dumb way
worksheet.addRow(["Fearless", 2008]);
// add an array of rows
var rows = [
["Speak Now", 2010],
{album: "Red", year: 2012}
];
worksheet.addRows(rows);
// edit cells directly
worksheet.getCell('A6').value = "1989";
worksheet.getCell('B6').value = 2014;
// save workbook to disk
workbook.xlsx.writeFile('taylor_swift.xlsx').then(function() {
console.log("saved");
});
@JieeiroSst
Copy link

delete row ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment