Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Getting"Insufficient memory to continue the execution of the program." exception,, when trying to write huge data in an excel sheet.

$
0
0

Hi,

In my project, There is a requirement of writing ~1000 columns and ~5000 rows of data from datatable to excel sheet, using C#.

When I convert all data from datatable to Object Array, and then try to load the Object array data to the excel sheet using below code :

  int rows = Output_DT.Rows.Count;
   int columns = Output_DT.Columns.Count;

   var startCell = (Excel.Range)oSheet.Cells[1, 1];
   var endCell = oSheet.Cells[rows + 1, columns];
   var writeRange = oSheet.Range[startCell, endCell];
   writeRange.Value2 = arr;

I am receiving an exception message as 

"Insufficient memory to continue the execution of the program.".

Kindly help me how to resolve this issue as I need to deliver my project , having above said requirements to my client .

Appreciate your help!!

Thanks in Advance.


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>