Created
          November 8, 2015 22:15 
        
      - 
      
- 
        Save natergj/62b9d2bfd3e2c6adf87a to your computer and use it in GitHub Desktop. 
    Very basic express.js app to create a route that generates and downloads a basic Excel workbook
  
        
  
    
      This file contains hidden or 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 express = require('express'); | |
| var xl = require('excel4node'); | |
| var app = express(); | |
| app.get('/', function(req, res){ | |
| res.end('Hello World'); | |
| }); | |
| app.get('/myreport', function(req, res) { | |
| makeReport(req, res); | |
| }); | |
| var server = app.listen(3000, function () { | |
| console.log('Example app listening at http://%s:%s', '127.0.0.1', 3000); | |
| }); | |
| function makeReport(req, res){ | |
| var wb = new xl.WorkBook(); | |
| var ws = wb.WorkSheet('Sheet1'); | |
| ws.Cell(1,1).String('String'); | |
| wb.write('MyWorkBook.xlsx', res); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment