Memory-efficient spreadsheet to CSV converter. Won't make you love PHP, but it handles big files well and supports 8 different file formats.
var excel = require('phpexcel-stream')
, fs = require('fs')
, csvParser = require('csv-parser')
, JSONStream = require('jsonstream')
fs.createReadStream('test/air_pollution_nl.xlsx')
.pipe( excel() )
.pipe( csvParser() )
.pipe( JSONStream.stringify() )
.pipe( process.stdout )
Returns a duplex stream - give it a spreadsheet, get back CSV. Optionally pass extension
as a file format hint to PHPExcel (format is autodetected otherwise).
- Office Open XML (.xlsx) (Excel 2007 and above)
- SpreadsheetML (.xml) (Excel 2003)
- BIFF 5-8 (.xls) (Excel 95 and above)
- Open Document Format/OASIS (.ods)
- Gnumeric (GNOME)
- HTML (why)
- SYLK (no idea)
- CSV (but you can and should use csv-parser in node)
- PHP >= 5.4.0, must be available in
PATH
With npm do:
npm install phpexcel-stream
MIT © Vincent Weevers. Test data © Statistics Netherlands, The Hague/Heerlen.