Error in Excel Write Range: The range does not exist, occurs after for loop

datatable
excel

#1

Hello,

I am a new UIPath user and I am trying to write a datatable into Excel after running it through a for loop for filtering purposes. However, when I try to write the datatable into Excel I get the following error: The range does not exist.

After browsing through the forum and searching for the issue on the net I could not find a solution. So far I have tried toggling the “Add headers” option, changing the position of Write Range and experimenting with another datatable (which worked without a problem). I have added the screenshot of the error message and the .xaml file to this post. I would appreciate it if you could guide me in the right direction.


Here are the link for the .xaml code: XAML file or File itself


#2

Hey @Ongun

For now this attached sample will work :slight_smile:
main (1).xaml (18.7 KB)

Will get back to you Tomorrow morning if will get some time the reason with Excel package how it is dealing here with Datatable in above case :slight_smile:.

Regards…!!
Aksh


#3

Thanks for the prompt answer I will try it asap. By the way I will appreciate it if you can point out the reason.


#4

Hey @Ongun

The above sample by me will work and it is working for me.
The Problem is with Excel Scope Activity for now in this particular case but on the other hand if you will use Workbook Read Range Activity it will sort out the problem for you.

Your problem is not big for now. as you mentioned other datatable it is working and i can see datatable is having one row.

The problem might be a column names in your datatable how they are seem to.
more can say on the issue when i will look into this.

Regards…!!
Aksh


#5

Okay thanks for the explanation. As far as I tried on my system your solution works perfectly fine, yet it does not write the datatable when Write Range (from Excel activities) is used inside an Excel Scope Activity as you said.

Do you mean using Workbook Read Range activity just before using the Write Range to solve the issue?