Write Range in Uipath Error "Value does not fall within the expected range"

Hey Everyone,
I am facing a problem , where I am using a For each row loop under Excel Application Scope . Now I filter a DataTable (in Sheet2) based on some condition from Sheet 1.
Now the I want to write/paste Filtered Data in Sheet3.

For this I am Write Range activity under the For Each row of Sheet 1.
When I use Write Range, it throws an error showing the “Value does not fall within the expected range”.

@Palaniyappan, @balupad14 @lakshman

Please help on the same.

1 Like

Hi
Use a KILL PROCESS activity before WRITE RANGE activity and mention as “EXCEL” in ProcessName property
and make sure that we use WRITE RANGE ACTIVITY from workbook activities
So the sequence be like this
—Excel application scope
—within that read range activity
—For each row loop
—Kill process
—write range from workbook with sheetname and filepath

Cheers @Aditya_Bhalerao

Hi,
Will the bot open the excel sheet again from which it was taking the data earlier .

1 Like

Yah of course
Cheers @Aditya_Bhalerao

Thanks @Palaniyappan.

You are a Saviour.

Kindly try this and let know for any queries or clarification
@Aditya_Bhalerao

Do I need to get out of the For Each row loop ??

1 Like

Yah if we keep the write range within
For each row loop it will write that range for each iteration

So keep the write range outside the for each row loop

@Aditya_Bhalerao

Let me check and get i’ll get back to you.

1 Like

@Palaniyappan

It doesnt work.

1 Like

Kindly share your xaml if possible
Cheers @Aditya_Bhalerao

https://forum.uipath.com/uploads/short-url/1VKLeCUfWu2O0tlRcjsNL4jkhhU.xlsx

https://forum.uipath.com/uploads/short-url/f0d6uywvvAxpYt7z2SaXZIciwCR.xaml

Guys Please find the Workflow and the Excel Sheet attached.