How to copy specific column in one excel file & copy to another excel

Currently, i am having one folder, which contains some excel files, i have to copy one column into another excel.

Thanks in advance

Hi @rsr.chandu

May i know more information about it ?

  1. Do u need to copy the specific column from all excels ?

You can read first excel file and then delete columns except one you want to copy from datatable. Now use write range tor write that datatable in another excel. Hope this helps, in case not then please provide more information on it

Yes one column “Amount”

I need to copy one column “amount” Value from all files in folder and paste into another excel

  1. Get all files directory.
  2. Use for each loop generic one to loop through files
  3. Read range on each file
  4. Delete all columns from datatable instead of amount column
  5. Write range new datatable with amount column in new excel
1 Like

Hi @rsr.chandu

You can try this way

  1. Use assign activity to get all files in the folder

file_list= Directory.GetFiles(folderpath)

  1. use for each activity to loop through all the file in file_list

inside the for each , do the following:
a. Use read range with file path and store in dt1
b. Now use the assign activity
dt1 = dt1.AsEnumerable().Select(Function(row) row(“amount”).ToString).CopyToDataTable

               c. use append range activity to append the dt1 to an excel file

Hope the logic helps you

Regards

Nived N

Happy Automation

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