High memory consume with Workbook.Open method

Hello everyone.

I am having a problem with the “Workbook.Open” method in Syncfusion.EJ2.Spreadsheet version=30.2.6

My application is running on a Linux Docker container, and when I try to open a large file (about 100 Mb) or a file with a chart using the Workbook.Open method, the container becomes unresponsive for a few minutes, and this problem impacts my application. When I try to open it using my local application, I notice that memory consumption is high, and even if the file is loaded, memory does not return to its initial state.

I have the impression that the file allocates memory for as long as it is open.


Thank's.


3 Replies

BP Babu Periyasamy Syncfusion Team August 27, 2025 08:55 AM UTC

Hi Otto Moura Machado Filho,


Thank you for reaching out to Syncfusion Support !


We have validated the reported issue of high memory usage when using the Docker image to process the large excel file. So, we have created a large Excel file of 40MB with dummy data, styles, and various features for testing purposes. We have prepared two Excel files:


  • File 1: Contains more data but fewer features such as styles, formatting, and charts. The file size is 40MB.
  • File 2: Contains over 100,000 used rows and 66 columns, with extensive use of styles, number formatting, conditional formatting, borders, etc.


To investigate the issue, we ran the Spreadsheet Docker image (version 30.2.4) and used the deployed URLs for the openUrl and saveUrl properties in the React client-side sample. When importing File 1, it took approximately more than a minutes to load in the Spreadsheet, and memory usage exceeded 4GB in the Docker container.


We then imported the same file multiple times (more than 7 times) and monitored the Docker container's memory usage. It increased to around 4–4.6GB but did not continue to grow indefinitely, indicating that memory is being properly cleared during repeated import actions. A screenshot of the memory usage is provided below for reference.


A graph with a line going up

AI-generated content may be incorrect.


Next, we tested File 2 by importing it into the Spreadsheet. The file continued processing for over 4 minutes before and returned the `Unsupported File` error. During this process, memory usage spiked from 0 to over 7GB in the Docker container which causes the Out of memory issue and returns the `Unsupported File` error. A screenshot of this memory usage is also provided below.


A graph with numbers and a line

AI-generated content may be incorrect.


Below we have shared the tested files and sample below for reference.


File1 : https://www.syncfusion.com/downloads/support/directtrac/general/ze/Large File - 40 MB  (3)

File2: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Copy of 106050Rx66C_styles_formats_charts_images_1

Sample link: https://stackblitz.com/edit/skzqexzd-vjc7fguj?file=index.js


How the Spreadsheet's Import and Export works:  

In our Spreadsheet component, when opening an Excel file into the Spreadsheet:

  • The file is sent to the server, where it is read using the XlsIO library and converted into a supported format (Workbook JSON) for the Spreadsheet component.
  • A workbook model is maintained in the backend, storing the dataset in JSON format.
  • The time and memory required to process the file depend on the features used (e.g., cell formatting, data validation, conditional formatting, wrapping, etc.) and the number of used rows and columns.


During export:

  • Spreadsheet data is converted to JSON and sent to the server.
  • The server uses the XlsIO library to convert this JSON back into an Excel file.
  • Similar to import, the processing time and memory usage depend on the file's complexity and range of used cells.


Therefore, when loading the above two files nearly the same in size but differing in the features applied—we observed that the first file loads properly, while the second consumes significantly more memory. This indicates that file processing time and memory usage are primarily influenced by the number of used cells and the complexity of applied features (such as formatting, validation, conditional formatting, etc.).


To help improve performance when opening Excel files, we offer an option to skip processing styles and number formats on the server. For more details, please refer to the documentation below:

https://ej2.syncfusion.com/aspnetcore/documentation/spreadsheet/open-save#improving-excel-file-open-performance-with-parsing-options


Note: We’ve introduced additional parsing options to ignore features such as charts, images, merged cells, formula, etc., during import. These enhancements will be available in our Volume 3 – Main release, tentatively scheduled for rollout by the end of August 2025.


Additionally, to prevent performance issues with large files, you can configure the Spreadsheet to alert and restrict large file imports. For more information, please refer to the below documentation.

https://ej2.syncfusion.com/aspnetcore/documentation/spreadsheet/performance-best-practices#how-to-improve-performance-when-opening-excel-files-in-the-spreadsheet


If you wish to integrate any changes into the Syncfusion Spreadsheet Docker image, you’ll need to build the ASP.NET Core project locally and then create a custom Docker image based on your modifications.


For your convenience, we’ve prepared an ASP.NET Core WebAPI project where:

  • The MaximumFileSize limit is set to 25 MB
  • The MaximumDataLimit is set to 5 million cells


If the imported file exceeds these limits, we update the ParseOptions in the OpenRequest by setting IgnoreFormat and IgnoreStyle to true, and then reprocess the request using Workbook.Open as mentioned in the below code snippet.


public IActionResult Open(IFormCollection openRequest)

{

     OpenRequest open = new OpenRequest();

     if (openRequest != null)

     {

         if (openRequest.Files != null && openRequest.Files.Count > 0)

         {

             // Assigning the file.

             IFormFile formFile = openRequest.Files[0];

             open.File = formFile;

         }

     }

     //Setting the MaximumFileSize limit to 25MB.

     open.ThresholdLimit.MaximumFileSize = 26214400;

     open.ThresholdLimit.MaximumDataLimit = 5000000;

     // Process the Excel file and return the workbook JSON result

     var result = Workbook.Open(open);

     if (result.Contains("FileSizeLimitExceeded") || result.Contains("DataLimitExceeded"))

     {

         //Re-send the request by setting the ParseOptions to ignore styles and formats.

         OpenRequest open2 = new OpenRequest();

         open2.File = openRequest.Files[0];

         open2.ParseOptions = new WorkbookParseOptions()

         {

             IgnoreFormat = true,

             IgnoreStyle = true

         };

         result = Workbook.Open(open2);

     }

     return Content(result);

}


Then, to build the docker image in local, please follow the below steps.


Step 1: Install the Docker Desktop.

https://hub.docker.com/editions/community/docker-ce-desktop-windows/


Step 2: Install .NET Core SDK version 8.0.

https://dotnet.microsoft.com/en-us/download/dotnet/8.0


Step 3: Download and Unzip the attached Docker project.

Docker project: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Spreadsheet-Server-Docker (2)


Step 4: Steps to Create Docker image and container to start the service,

  • Open the command prompt under the root folder of the Docker sample.
  • Type the following command in the command prompt to build the docker service,


docker build -t spreadsheet-docker .


  • Type the following command to start the service,


docker run -d -p 6002:8080 --name ej2service spreadsheet-docker

  

Step 5: Now the Spreadsheet server Docker instance runs in the localhost with the provided port number.


Step 6: And then, we have modified openUrl and saveUrl properties in the client-side sample based on the deployed service like the below code snippet.



openUrl: 'http://localhost:6002/api/spreadsheet/open',                                                           

saveUrl: 'http://localhost:6002/api/spreadsheet/save',


Also, you can find the default Docker sample project in the below repository.

https://github.com/SyncfusionExamples/Spreadsheet-Server-Docker


To further optimize performance, we’ve logged the following feature requests aimed at reducing memory consumption and minimizing JSON size in Spreadsheet and actively working on this improvement. These features will be available on or before Volume 1 – 2026 release.


  1. Maintain Styles at Row/Column Level: Avoid repeating styles in every cell by applying them at row or column level to reduce JSON size.
    https://www.syncfusion.com/feedback/53043/provide-support-to-maintain-the-styles-in-row-and-columns-for-reducing-the-server


  1. Performance Improvements for Large Files: Optimize feature-specific logic to reduce load times and memory usage for large datasets.
    https://www.syncfusion.com/feedback/27513/performance-improvement-while-importing-large-excel-datain-spreadsheet


Please review the above details at your convenience. To help us validate further, kindly share the specific Excel file (with dummy data) that is causing the issue. Based on that, we’ll analyze the file and provide detailed feedback.


Please feel free to reach out to us if you have any further questions or concerns.


Regards,

Babu.



OM Otto Moura Machado Filho September 16, 2025 05:50 PM UTC

Hello, Babu Periyasamy.


Sorry for the delay in responding.

Thank you for your excellent response.

We will discuss this solution with my team.


Thank you very much.



BP Babu Periyasamy Syncfusion Team September 18, 2025 05:02 AM UTC

Hi Otto Moura Machado Filho,


Thanks for the update. Take your time and we will wait to hear from you. If you have any questions or need further assistance in the meantime, don't hesitate to reach out. We're always here to help!


Regards,

Babu.


Loader.
Up arrow icon