Need help with excel-stream?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

dominictarr
130 Stars 31 Forks MIT License 25 Commits 9 Opened issues

Services available

!
?

Need anything else?

Contributors list

# 3,772
ESLint
texture...
Electro...
TypeScr...
7 commits
# 19,781
JavaScr...
Shell
Markdow...
Electro...
7 commits
# 54,723
golang
hostsfi...
Nuxt.js
express...
4 commits
# 20,232
serverl...
Ruby
github-...
webscra...
1 commit
# 18,885
Babel
mapbox-...
mapbox-...
Django
1 commit

excel-stream

A stream that converts excel spreadsheets into JSON object arrays.

Examples

// stream rows from the first sheet on the file
var excel = require('excel-stream')
var fs = require('fs')

fs.createReadStream('accounts.xlsx') .pipe(excel()) // same as excel({sheetIndex: 0}) .on('data', console.log)

// stream rows from the sheet named 'Your sheet name'
var excel = require('excel-stream')
var fs = require('fs')

fs.createReadStream('accounts.xlsx') .pipe(excel({ sheet: 'Your sheet name' })) .on('data', console.log)

stream options

The

options
object may have the same properties as csv-stream and these two additional properties:
  • sheet
    : the name of the sheet you want to stream. Case sensitive.
  • sheetIndex
    : the sheet number you want to stream (0-based).

Usage

npm install -g excel-stream
excel-stream < accounts.xlsx > account.json

options

newline delimited json:

excel-stream --newlines

formats

each row becomes a javascript object, so input like

foo, bar, baz
  1,   2,   3
  4,   5,   6

will become

[{
  foo: 1,
  bar: 2,
  baz: 3
}, {
  foo: 4,
  bar: 5,
  baz: 6
}]

Don't Look Now

So, excel isn't really a streamable format. But it's easy to work with streams because everything is a stream. This writes to a tmp file, then pipes it through the unfortunately named j then into csv-stream

License

MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.