Can't converter .xlsx form to .json due to "FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory"

I am trying to add a new form in my Sync-Endpoint Server. To do it I created a proper form.xlsx file with all the necessary sheets. To converter the .xlsx file to .json I used the following command
grunt xlsx-convert-all
But I got the following error trace

I have increased by typing node --max-old-space-size=8192 xlsx.js and overall export NODE_OPTIONS=--max-old-space-size=8192 but anything solved this problem.

Here (171.7 KB) it is the .xlsx file. OBS: I have used it before in ODK stack without problem.

Hi @ghteotonio! I am not sure if this will help for the specific error you are getting, but one thing I do when xlsx-convert-all throws an error is try converting the specific form that has a problem in the chrome interface instead. If you type grunt that should pop up, you can go to the converter tab and convert there, and there tend to be more details on errors – at least the errors I usually have from issues in the form. Not as sure about this one…

Hi @elmps2018! Thanks for the fast response. I usually use the chrome interface to convert. It helps to get any error but it his case the interface just crash when it starts to load the selected .xlsx file. That is the reason why I am using the command line, trying to get more information about the interface crash and error when converting.
The converter interface does not show any error, just crash chrome.

@elmps2018 Do you think that a large number of list_name in the choice sheet can trigger any error due to limit of js operators/methods?

I have used fairly long lists without any trouble, but that’s possible. You could move cidades to a csv perhaps, and then do it as a multi-level list which may implement better.

Hi @ghteotonio

There are 2 empty rows at the very bottom of the first sheet in your form. So the converter tried to process the entire sheet of more than 1 million rows.

You can download the fixed file here Senado9.xlsx (171.7 KB)

There are syntax errors in your form so it still can’t be converted successfully.
If your want to place multiple prompts on the same page, use begin screen and end screen. See the links below for more information.

https://docs.odk-x.org/xlsx-converter-using#creating-a-simple-survey-form

https://docs.odk-x.org/xlsx-converter-reference

2 Likes

Thanks a lot @linl33!

1 Like