sheet_to_json use lots of memory
See original GitHub issuei upload a 11 kb xlsx file and want to convert it to json in my server. my server only has 512mb memory, and i got node process killed when execute sheet_to_json
method. the scripts works well in my pc which has 8gb memory.
is sheet_to_json
function use a lot of memory which is much bigger than file itself ? is there any tips to solve memory problems ? thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Reading first n lines of sheet using xlsx module - Stack Overflow
sheet_to_json (workbook.Sheets[sheetsList[i]], { header: 1, defval: '', blankrows ...
Read more >Data Import | SheetJS Community Edition
In-browser processing where users drag-and-drop files or use a file element ... The recommended approach is to buffer streams in memory and process...
Read more >xlsx - npm
There are 3479 other projects in the npm registry using xlsx. ... method attempts to package data from the workbook into a file...
Read more >How to convert XLSX to JSON - DEV Community
The sheet_to_json function allows to convert a spreadsheet into an array of objects. ... It is time to use it. We are going...
Read more >fatal error: reached heap limit allocation failed - You.com
JavaScript heap out of memory while creating a huge file using createWriteStream in node.js ... SheetNames; const data = Excel.utils.sheet_to_json(file.
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
The root cause of the issue is a bad reported sheet size: If you unzip the file (XLSX is really a zip format) and look at the xml in
xl/worksheets/sheet1.xml
you’ll see:The first line says that the file has over 1M records and the second line is completely unnecessary (guessing it was exported from a third party tool?)
Can you try overwriting the range using the
update_sheet_range
function from the wiki:Call that function on the worksheet just before passing it to
sheet_to_json
. It scans the cells to recalculate the range.It seems to be beter by using type Map; (node verison v14.9.0)
this may be helpful:
reference link: node issue v8 issue