sheet_to_json skips empty rows
See original GitHub issueWhen calling xlsx.utils.sheet_to_json(sheet, {header: 1})
I would expect to receive an array of arrays including empty rows. However the function explicitly skips out empty rows which makes it impossible to select a particular row in the results. It would be good to make this behaviour configurable.
As a workaround, I have used sheet_to_csv
, which doesn’t skip rows, followed by csv-parse.
Issue Analytics
- State:
- Created 9 years ago
- Comments:42 (6 by maintainers)
Top Results From Across the Web
sheet_to_json does not skip blank rows · Issue #1078 - GitHub
In this call, sheet_to_json will skip blank rows (since we did not specify header: 1 ). The {a: ""} object is generated since...
Read more >SheetJS shows blank rows - Stack Overflow
In order to remove the rows without any data you can use the option blankRows: false , like this: const data = XLSX.utils.sheet_to_json(ws, ......
Read more >Utility Functions - SheetJS Community Edition
blankrows must be set to false to skip blank lines. Fields containing the record or field separator will automatically be wrapped in double...
Read more >A brand new website interface for an even better experience!
sheet_to_json skips empty rows.
Read more >Ho to skip blank rows while reading data from the excel sheet
Hi, We want to skip the blank rows while reading data from the excel sheet. Is there any method that we can use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It was also not working for me until I added the ‘defval’ param: var roa = XLS.utils.sheet_to_row_object_array(workbook.Sheets[sheetName], {defval: ‘’})
@EDUARDOMBRAGA @SheetJSDev
I am using angular 6 and it will work on angular 5…
package.json "xlsx": "^0.12.13"
in Fileimport * as XLSX from 'xlsx';
This will work on xlsx, Only one I used it on.
XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], {header: 1, defval: null});
defval does the magic here, ‘null’ is what I want in place if I wanted empty string in place of empty cell
XLSX.utils.sheet_to_json(workbook.Sheets[sheetName], {header: 1, defval: ''});
defval can be any value you set.