Skip to content

Instantly share code, notes, and snippets.

@natergj
Created November 24, 2015 00:45
Show Gist options
  • Save natergj/2679f3e0635333b9fdd0 to your computer and use it in GitHub Desktop.
Save natergj/2679f3e0635333b9fdd0 to your computer and use it in GitHub Desktop.
Very basic sample using node's native http module
var xl = require('excel4node');
var http = require('http');
http.createServer(function(req, res){
switch(req.url){
case '/download':
var wb = new xl.WorkBook();
var ws = wb.WorkSheet('Sheet 1');
ws.Cell(1,1).String('String');
wb.write('Excel.xlsx', res);
break;
default:
res.end('Hello World');
break;
}
}).listen(3000, function(){
console.log('download file at http://localhost:3000/download');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment