CSV to Excel Memory Consumption


We have to be able to convert at least 1 Million rows x 50 cols from csv to excel worksheet. I have tried this and the memory usage goes up to many GB even when I am streaming the file. How can I make sure I actually stream the file and do not use so much memory?

The code I use is below

            FileStream fstream = new FileStream(tempCsvPath, FileMode.Open);

            LoadOptions csvLoadOptions = new LoadOptions(LoadFormat.CSV);

            Workbook csvWorkbook = new Workbook(fstream, csvLoadOptions);



Thanks for using Aspose APIs.

Please use MemorySetting.MemoryPreference for your needs. Here is the code to load your CSV file and then convert it to XLSX format.


LoadOptions opts = new LoadOptions(LoadFormat.CSV);
opts.MemorySetting = MemorySetting.MemoryPreference;

Workbook wb = new Workbook("yourCSV.csv", opts);