I am trying to read an excel sheet with 350k+ rows. I keep getting the out of memory error.
I have seen similar issues on this forum where people solved with reading in chunks, but I can’t quite figure out the workflow of how to read the excel sheet in chunks to create one datatable variable that I can then manipulate according to my requirements.
Can someone help? I need all the data from excel in one Dt variable.
Hi,
I haven’t tried this, so I don’t know if it will certainly work. But I have read on some forums that ExcelDataReader is a light weight tool that will help with reading larger files.
There is a thread on stackoverflow which explains how to use this -
Hi,
Give me some time, I will try this and let you know.
Meanwhile, I feel 350K rows in a single datatable variable might still lead to OutOfMemory Exception anyway. Will it not be better to load X rows at a time into a database, process them and then get the next X rows and so on?
You can figure out the highest X value through trial and error (it shouldn’t slow down your system + no OutOfMemory exceptions)
This can be done easily in the read range activity, by specifying the Range property
First iteration, A1:X
Next iteration, A(X+1):(X+1+X) and so on…