Read Specific Data From one Excel and Write another excel file

Hi all,

I’m a UiPath trainee, my TL gave me a task.
In a folder there is more than 10 excel files, in these excel file having employee details.
I want read the specific Data ( Emp_Name, Designation, Salary etc) and write into another excel file. These data are place different cells.


All the excel having the student detail???


Use below code to get all the excel file.
Directory.GetFiles(@"c:\MyDir\", "*.xlsx" )

Use read range activity to get the data into data table.

After getting data check the given data is present or not

If yes use write range activity to write the data into new excel sheet


Please post the sample excel file, then it will be easy to assist.

Karthik Byggari

Here with attached the Screenshot. Pls find

  1. First read the excel data into a data table. Use Read Range Activity under Excel application scope.

  2. And then use DataTable.Select to filter the employee data.

For example, Assign Activity

dtRow = yourDataTable.Select("[First Name]='Lois' AND [Last Name]='Walker'")

The above expression will return a data row of matching employee first and last name.

  1. Use Append Range activity and pass the data row of above step as input.

Karthik Byggari

1 Like

Thanks for your quick response. @KarthikByggari
Also i have a another question.
Like this same logic, we have a employee(s) details in separate separate Excel files (more than 20) in a folder, i wanna read data from different cells [Example: D1, D23, E5, E14] in each XL files and write these data into a another one excel file. Kindly guide me for this.


1 Like

Hi @muthu.m
For this you can get the files fro folder using Directory.Getfiles(“Your Path of variable”) And iterate each file using for each loop. In the for each loop read that cells using the Read Cell activity.


Use assign activity create variable with string= directory.getfiles(“your folder path”,“*.xlsx”)

Then take for each loop

Type argument should be string

Take excel application scope mention item.tostring (which is your excel)

Inside excel application scope use read cell activity mention cell which you want to read

Hope this helps


Sample Code please
@KarthikBallary @aman_sheik

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