Automatically change value(path) in assign activity each time the process start

Hello ,

I’m running a process with require taking information from excel file. And i have that in Assign activity where i mention in the value the path of the file. After that i’m doing this Excel assign activity output as DataTable and using it in for each a lot of times.

So basically i want to make it after process end. Start again and automatically change the value with another excel file.

I have read that this is possible with config file with can contain all values for the excel files(paths) , but i’m not sure how.

Since i wanna fully automate it to don’t require person to manually change value of assign activity with another path after each time it ends. This way i can run it in Orchestrator which is the main goal. I guess i will need to LOOP the whole process and change the excel file to another.

1 Like


If i am understand you correctly, you have multiple Excel Files and do some processing for every file?

If this is the case then you can use Directory.GetFiles and use Foreach Loop, Inside For Each loop you can use your logic for every file

Hope this may helps you


I want to do the process for one file(excel) than the same process from start for another file. But this file(excel) is used as DataTable. So you mean in the assign activity to mention Directory.GetFiles and put all excel files in one folder and the uipath will take first excel will make it datatable after it finish everything will take the next one ?

If i do this i got error on mine Read Range activity since i have to make it array of string’s i got this :


In ForEach give Directory.GetFiles(PathofDirectory)

and inside place your logic

Hope this will helps you


Hi @Shwapx

Hope these steps would help you resolve this issue

—use a assign activity like this
arr_filepath = Directory.GetFiles(“yourfolderpath”,”*.xlsx”)

Where arr_filepath is a variable of type array of string

—then use a FOR EACH activity and pass the above variable as input and change the type argument as string in the property panel
—inside the loop use READ RANGE and pass the input filepath as item which will be holding the filepath of the first file

Then after processing the data inside the same FOR EACH activity, atlast before getting out of loop use MOVE FILE activity and mention the folder path of the files where it is stored, in source property
And in destination property mention a new folder path where this first file will be moved

—next to this move file activity use a BREAK activity so that the loop will stop after processing first file

From next when it runs it starts with next file and stops after processing that as we are storing the loop with break after one iteration itself

Cheers @Shwapx

Down below through the process i’m using read cell values is this going to be a problem i can this solution tomorrow and will report. Otherwise if i can make this read cell not hard coded , but mention maybe the name of the column

Since data is like this


A1 - column name / A2 - value data

I did it with read cell since i dont know how to make it to get data like that

I have several cases where data is


This is easy with row.item(columnname)

Hello this is what i mean :

also i have in the process some read cell activities :

which have the same issue.

You mean to pass input file as Item.ToString ?

I got an error on first read range activity workbook dose not exist.

Hello I have manage to do it to read each file go through the process and after that start with the other file. I’m not using break activity since the robot stop with break activity i want to go through all files. The idea for move every file when it end with it it’s really good this way will know which file is done , but i didn’t manage to do it since when i enter From (filepath) where are all files To(filepath of new folder) i got error message. That it cannot find the file or anything like that.

This is how i make it to work with read range and read cell.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.