Created
April 13, 2016 01:43
-
-
Save nealrs/4bdcb6316665338d9a1f7c2b690d6a19 to your computer and use it in GitHub Desktop.
ExcelJS demo for Git@Me
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
delete row ???