Process Excel Files in batches

Hi Everyone,

I need some help in building a logic for below instance.
I have a list which contains excel file that can be any number like 1000, 2112 etc.
I want to process data in batches like if the file count is 5500, I want to process it in batches of 1000.

More clear example - I have a list of files count 5540, I have to loop over each file to merge it. I need to loop over them in batches like if batch is of 1000 then there would be 6 batches 1000x5 and 1 batch left of 540> I also need to keep in mind that the files already processed do not process again or they should be skipped

Please help.
@Nithinkrishna can you help here also?

Thanks

1 Like

Sure @Dhruvi_Arumugam

Thanks for tagging. It will be the same as previous logic expect the batch count number which I updated as below.

For-each(file in fileList) out index
{
    //Your Logic

    If(index+1 mod 1000 == 0 OrElse index+1 = fileList.Length)
    {
        //Write output file
    }
    Else
    {
        //Continue
    }
}

Hope this helps.

Thanks
#nK

Is there any other way were we can use multiple loops depending upon batch size as continuing in the same loop fir these number of files generally makes uipath robot slower?

1 Like

Hey @Dhruvi_Arumugam

You can use parallel for-each but that may cause issues when it try to write it back to excel.

Thanks
#nK