read-excel-file 2.0.5 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ <!-- 3.0.0 — Don't return empty data in case of an error; throw the error instead. -->
2
+
1
3
  2.0.1 / 26.06.2018
2
4
  ==================
3
5
 
package/README.md CHANGED
@@ -32,7 +32,7 @@ input.addEventListener('change', () => {
32
32
  ## Node.js
33
33
 
34
34
  ```js
35
- import readXlsxFile from 'read-excel-file/node'
35
+ const readXlsxFile = require('read-excel-file/node');
36
36
 
37
37
  // File path.
38
38
  readXlsxFile('/path/to/file').then((rows) => {
@@ -165,17 +165,25 @@ Node.js `*.xlxs` parser uses `xpath` and `xmldom` universal packages for XML par
165
165
  By default it reads the first sheet in the document. If you have multiple sheets in your spreadsheet then pass `sheet: number` or `sheet: string` as part of the `options` argument (`options.sheet` is `1` by default):
166
166
 
167
167
  ```js
168
- readXlsxFile(selectedFile, { sheet: 2 }).then((data) => {
168
+ readXlsxFile(file, { sheet: 2 }).then((data) => {
169
169
  ...
170
170
  })
171
171
  ```
172
172
 
173
173
  ```js
174
- readXlsxFile(selectedFile, { sheet: 'Sheet1' }).then((data) => {
174
+ readXlsxFile(file, { sheet: 'Sheet1' }).then((data) => {
175
175
  ...
176
176
  })
177
177
  ```
178
178
 
179
+ To get the list of sheets one can pass `getSheets: true` option:
180
+
181
+ ```js
182
+ readXlsxFile(file, { getSheets: true }).then((sheets) => {
183
+ // sheets === { 1: 'Sheet1', 2: 'Sheet2' }
184
+ })
185
+ ```
186
+
179
187
  ## References
180
188
 
181
189
  For XML parsing [`xmldom`](https://github.com/jindw/xmldom) and [`xpath`](https://github.com/goto100/xpath) are used.