Import of large data from Excel to my .net application RRS feed

  • Question

  •   Hi

      We have a requirement where we need to import data from MS Excel file with 50-60 colums and more than 7 lakh records.

      For faster import, we have added this code :

          Object[,] myArray = (object[,])Range.get_Value(XlRangeValueDataType.xlRangeValueDefault);

      On running when the rows are more than 7 lakhs , I get "System.OutOfMemoryException". Please give advice for this problem.  

    Note: We have 4GM Ram and enough hard disk space. 

       Thanks in advance





    Saturday, March 11, 2017 8:43 AM

All replies

  • Hi SNarayan,

    with this only one line , we can't assume how you are importing the data or what logic you had used in your code.

    I suggest you to try to import the part of the data.

    do not try to import all the data at once.

    divide it in small segments and try to import it segment by segment.

    like for example I have 1000 records then try to split in a bunch of 200 records and then try to import it.

    if you are using any objects then then try to clear the objects after each segment imported.

    if you try to develop the code like this then it can solve your memory exception.

    I think that issue is related with your .net application and with Excel. and it not related with your RAM and Harddisk.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, March 13, 2017 9:25 AM