Uncaught RangeError: Maximum call stack size exceeded #40

Closed
opened 2013-12-20 02:42:59 +00:00 by ghost · 12 comments
ghost commented 2013-12-20 02:42:59 +00:00 (Migrated from github.com)

I have a rather big spreadsheet. 1MB with almost 15,000 rows.

Importing it will give me this "Maximum call stack size exceeded" error.
I tried and noticed that the error no longer occurs when the rows are reduced to 1,000.

Is there a solution? :)

I have a rather big spreadsheet. 1MB with almost 15,000 rows. Importing it will give me this "Maximum call stack size exceeded" error. I tried and noticed that the error no longer occurs when the rows are reduced to 1,000. Is there a solution? :)
SheetJSDev commented 2013-12-20 05:08:15 +00:00 (Migrated from github.com)

There's always a solution :)

I suspect it may be a formatting issue (related repo: https://github.com/SheetJS/ssf) that hasn't been merged yet. Can you share the file? If you want to send it to me directly, dev@sheetjs.com

There's always a solution :) I suspect it may be a formatting issue (related repo: https://github.com/SheetJS/ssf) that hasn't been merged yet. Can you share the file? If you want to send it to me directly, dev@sheetjs.com
ghost commented 2013-12-20 15:05:06 +00:00 (Migrated from github.com)

haha kewl :)

The file I was using is a sample from here: https://db.tt/2yXZkA7M

haha kewl :) The file I was using is a sample from here: https://db.tt/2yXZkA7M
SheetJSDev commented 2013-12-20 16:08:00 +00:00 (Migrated from github.com)

@tUrG0n the node module works fine from here:

$ npm install -g xlsx
$ xlsx2csv ~/Downloads/Dubai\ Database.xlsx

939e5dc342/Dubai+Database.csv

According to chrome, the issue is coming from the call

String.fromCharCode.apply(null, new Uint8Array(data));

When I change it to use the readAsBinaryString function and disable the worker, it appears to work:

        reader.onload = function(e) {
            var data = e.target.result;
            var wb = XLSX.read(data, {type: 'binary'});
            process_wb(wb);
            }
        };
        reader.readAsBinaryString(f);

It appears that IE9 supports readAsArrayBuffer but not readAsBinaryString https://developer.mozilla.org/en-US/docs/Web/API/FileReader.readAsBinaryString .

I will push a change so that it checks for rABS and only falls back to rAAB if the former is unavailable

@tUrG0n the node module works fine from here: ``` $ npm install -g xlsx $ xlsx2csv ~/Downloads/Dubai\ Database.xlsx ``` https://gist.github.com/SheetJSDev/bd8775ead7503b4fb583/raw/939e5dc342475beebdd1bb82cebc60aad53a0e7b/Dubai+Database.csv According to chrome, the issue is coming from the call ``` String.fromCharCode.apply(null, new Uint8Array(data)); ``` When I change it to use the readAsBinaryString function and disable the worker, it appears to work: ``` reader.onload = function(e) { var data = e.target.result; var wb = XLSX.read(data, {type: 'binary'}); process_wb(wb); } }; reader.readAsBinaryString(f); ``` It appears that IE9 supports readAsArrayBuffer but not readAsBinaryString https://developer.mozilla.org/en-US/docs/Web/API/FileReader.readAsBinaryString . I will push a change so that it checks for rABS and only falls back to rAAB if the former is unavailable
ghost commented 2013-12-20 20:12:15 +00:00 (Migrated from github.com)

kewl. Ping me when you do so ^_^

Thank you for the bleeding fast response!! 👍

kewl. Ping me when you do so ^_^ Thank you for the bleeding fast response!! :+1:
ghost commented 2013-12-26 04:27:23 +00:00 (Migrated from github.com)

any updates? :)

any updates? :)
SheetJSDev commented 2013-12-26 05:43:57 +00:00 (Migrated from github.com)

@tUrG0n I pushed the aforementioned change to the gh-pages branch and it shows up at http://oss.sheetjs.com/js-xlsx/ Let me know if this works!

@tUrG0n I pushed the aforementioned change to the gh-pages branch and it shows up at http://oss.sheetjs.com/js-xlsx/ Let me know if this works!
ghost commented 2013-12-27 03:49:37 +00:00 (Migrated from github.com)

I tried the interface and it works. Gona update my code and make sure it works there to :)

Cheers,
Piotr

I tried the interface and it works. Gona update my code and make sure it works there to :) Cheers, Piotr
SheetJSDev commented 2014-01-10 20:01:18 +00:00 (Migrated from github.com)

@tUrG0n is it working in your code? If so, close the issue :)

@tUrG0n is it working in your code? If so, close the issue :)
ghost commented 2014-01-12 06:57:53 +00:00 (Migrated from github.com)

yes yes, sorry man my bad :3
Thanks for being so responsive :) 👍

yes yes, sorry man my bad :3 Thanks for being so responsive :) :+1:
SheetJSDev commented 2014-01-12 08:15:28 +00:00 (Migrated from github.com)

@tUrG0n no worries, I appreciate your help in finding the issue :)

@tUrG0n no worries, I appreciate your help in finding the issue :)
tjvg91 commented 2016-01-13 02:53:28 +00:00 (Migrated from github.com)

Hi guys.

I get the same error but i don't quite understand the solution. This is my code:

reader.onload = function(e) {
            var data = e.target.result;
            var wb = XLSX.read(data, {type: 'base64'});
        };
        reader.readAsArrayBuffer(f);

Please help. Thanks

Hi guys. I get the same error but i don't quite understand the solution. This is my code: ``` reader.onload = function(e) { var data = e.target.result; var wb = XLSX.read(data, {type: 'base64'}); }; reader.readAsArrayBuffer(f); ``` Please help. Thanks
tjvg91 commented 2016-01-13 02:59:28 +00:00 (Migrated from github.com)

Correction:

reader.onload = function(e) {
            var data = e.target.result;
            var arr = String.fromCharCode.apply(null, new Uint8array(res));
            var wb = XLSX.read(arr, {type: 'base64'});
        };
        reader.readAsArrayBuffer(f);
Correction: ``` reader.onload = function(e) { var data = e.target.result; var arr = String.fromCharCode.apply(null, new Uint8array(res)); var wb = XLSX.read(arr, {type: 'base64'}); }; reader.readAsArrayBuffer(f); ```
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#40
No description provided.