Error "Incorrect file format" on importing Excel file with large worksheet

Posted by: pdoxakis on 28 November 2024, 12:42 pm EST

    • Post Options:
    • Link

    Posted 28 November 2024, 12:42 pm EST - Updated 28 November 2024, 12:46 pm EST

    When a worksheet contains a certain number of rows and columns, spreadjs fail to open the file. I get the following error: Incorrect file format.

    I can reproduce it with the following spreadjs designer (latest version. currently: 17.1.10): https://developer.mescius.com/spreadjs/designer/index.html

    In attachment, uncompress the file “Excel files.7z” and use the file “With 157578 rows and 330 columns.xlsx” to see the error in popup.

    Also, I investigated to know what are the current limitations.

    So, I coded an algorithm to determine the number of rows I can have for a given number of columns.

    (c# code in attachment)

    I used Selenium with Chrome. When using Selenium, I could reproduce it with less rows in the file (compared to using chrome only).

    Here is the results, I get with the code:

    With 16384 columns (Excel limit), it fail with 823 rows (13 484 032 cells)

    With 250 columns, it fail with 52 583 rows (13 145 750 cells)

    With 200 columns, it fail with 65 641 rows (13 128 200 cells)

    With 100 columns, it fail with 130 065 rows (13 006 500 cells)

    With 50 columns, it fail with 256 762 rows (12 838 100 cells)

    With 20 columns, it fail with 627 711 rows (12 554 220 cells)

    With 12 columns, it fail with 1 013 446 rows (12 161 352 cells)

    With 11 columns, it is not possible since we would hit the Excel limit (1048576 rows)

    Even with the new way to import an Excel file (ref: https://developer.mescius.com/spreadjs/docs/features/spreadjs-file-format ), it does not work and I get the same error message.

    Thanks!

    Philip

    attachments:

    Files.zip

  • Posted 29 November 2024, 3:31 am EST

    Hi,

    The file you mentioned, “With 157578 rows and 330 columns.xlsx,” is approximately 133MB, which is too large for even online platforms like Excel Online or Google Sheets to load due to browser resource limitations. When attempting to load such a large file in SpreadJS, it fails to load and throws an “Incorrect file format” error.

    When attempting to load the blob and read its text using a native API, nothing is returned for large files. In SpreadJS, if the text cannot be read from the blob, the primary assumption is either an incorrect file format or a damaged file. From SpreadJS’s loading strategy, there is no file size restriction, which is why there is no “File is too big” exception.

    While SpreadJS itself does not impose file size limitations for importing files, its performance depends on browser memory availability. Even a 5MB file might consume significantly more memory once loaded into SpreadJS, as the workbook’s memory usage depends on factors like the number of formulas, data volume, formatting, etc. As a result, crashes or failures can occur based on content rather than file size alone.

    The ability to predict whether a file will load successfully cannot be determined solely by the number of rows and columns. To address potential issues, monitoring the memory usage of the current page is crucial. However, native methods for memory usage monitoring are not universally supported across browsers and have strict limitations. For further details, refer to:

    References:

    https://developer.mozilla.org/en-US/docs/Web/API/Performance/memory

    https://developer.mozilla.org/en-US/docs/Web/API/Performance/measureUserAgentSpecificMemory

    Regards,

    Priyam

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels