Author Topic: Excel export not working with more data  (Read 2174 times)

sshede

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
    • View Profile
Excel export not working with more data
« on: November 18, 2020, 12:06:39 pm »
When I try export Excel (25000 Rows and 168 column ) that time my browse is crash.

 type: 'button',
                        label: "Export",
                        render: false,
                        icon: 'ui-icon-arrowthickstop-1-s',
                        listener: function () {
                            this.option("pageModel", false);
                            var colModel=this.option("colModel");
                            colModel[3].hidden = true;
                            this.option("colModel",colModel);
                            var format = $("#export_format").val(),
                                blob = this.exportData({
                                    format: format,
                                    nopqdata: true, //applicable for JSON export.
                                    render: false,
                                    nopqdata: true, //applicable for JSON export.
                                });
                            if (typeof blob === "string") {
                                blob = new Blob([blob]);
                            }
                            saveAs(blob, "AllBreakDetail." + format);
                            var colModel=this.option("colModel");
                            colModel[3].hidden = false;
                            this.option("colModel",colModel);

                            $grid.pqGrid("option", {"pageModel": pageModel});
                            $grid.pqGrid("refreshView");
                            $(".pq-grid-footer").append("<span class='allBreckCount'>Total Breaks: "+data.length+"</span>");
                        }
                    },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6173
    • View Profile
Re: Excel export not working with more data
« Reply #1 on: November 18, 2020, 03:53:04 pm »
That's quite large number of cells: 25000*168 = 42,00,000 i.e., 4.2 million.

I put that to test: https://stackblitz.com/edit/paramquery-demo-perf?file=index.js

It exports to Excel in 50 seconds on an i3 2GHz core duo processor but doesn't crash the browser, though there is wait / kill message in the browser which is expected for a long running process.

Excel opens the exported file in much larger time: 55 seconds

Do you have some numbers to share?

1. How many rows and cells are you able to export without crashing the browser and in how much seconds?

2. Could you share a complete sample in stackblitz to reproduce the browser crashing issue so that I can check it.
« Last Edit: November 18, 2020, 03:55:06 pm by paramvir »

sshede

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
    • View Profile

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6173
    • View Profile
Re: Excel export not working with more data
« Reply #3 on: November 18, 2020, 09:54:26 pm »
There are issues in your code due to which there is no output in Stackblitz:

Invalid shorthand property initializer

Please correct your js code.

sshede

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: Excel export not working with more data
« Reply #4 on: November 19, 2020, 12:52:33 pm »
I check your example it is working but my cell data is more. your cell data only a1 a2.
I put 35000 row in your example and check but browser not responding.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6173
    • View Profile
Re: Excel export not working with more data
« Reply #5 on: November 19, 2020, 08:07:38 pm »
Still the browser doesn't crash.

It takes 70 seconds to export with (35,000 * 168) cells on a lower configuration system which is expected and apparently nothing can be done about it.

If you want to make it faster, then you can try the csv export