How to Fix the java.lang.OutOfMemoryError while Loading Large Spreadsheets

How to Fix the java.lang.OutOfMemoryError While Loading Large Spreadsheets

Aspose.Cells APIs provide Memory Preferences to optimize memory consumption while loading and processing spreadsheets. These options are also helpful in efficiently loading large spreadsheets containing huge data sets into a Workbook object, as demonstrated below.

Java

 // Specify the LoadOptions
LoadOptions options = new LoadOptions();

// Set the memory preferences
options.setMemorySetting(MemorySetting.MEMORY_PREFERENCE);

// Instantiate the Workbook and load the large Excel file containing a large data set
Workbook book = new Workbook("sample.xlsx", options);