Copy entire Row of Excel Workbook1 and paste it in Workbook2 by Robot

Hello there,

im trying to copy a row from one workbook and paste it to another workbook.

I would like to copy the entire row (which is a bit long).
I actually have to open several workbooks and get the first row and paste it into another workbook (lets call it main workbook)

Can somebody give a example of this?

Thank you very much for the support!

Hello @blend , Welcome to UiPath Community.

Simply use the Read Range activity to read the first row. So you can get only first row of your Excel file. And then paste it to the another excel.

Like you have 4 columns. Use this range “A1:D2”.
First row was your headers.

TanQ,
Michael Udhaya.

1 Like

Hi @blend

Welcome to uipath community

I guess you can read range from all and if columns are the same you can store everything into a data table and at once dump it in the new workbook. (Write range without creating the workbook will create one file for you)

If you want to replicate then dynamic write range with incrementing the file names can also be done.

make sure you keep ‘add headers’ unchecked…

Regards :slight_smile:

1 Like

Hi @blend

Welcome to UiPath community buddy
Kindly follow the below steps that could help you resolve your issue…
1.use a assign activity and get the file path of all the workbooks you have, with a variable of type string array
Infilepath = Directory.GetFiles(“yourfoldername”,"*.xlsx")
Which would give the file path of all the excel as a array of string
2. Use a for each loop and pass the above variable as input and change the type argument as string in the property of for each loop
3. Inside the for each loop, use Excel application scope and mention the filepath input as item, the variable obtained from for each loop which has the file path in a array
4. Next to this use a read range activity and mention the range as “A1:M2”
Here i mention as M, you can mention the columnname you have in your workbook…and the reason why i mentioned as 2 next to M is as you said we need the first row alone…
5. Now use a write range activity from workbook activities ( not under excel activity )
Where mention the workbook file path second workbook B and mention the sheet name where you want to enter the above obtained data from read range activity…and mention the range as “”

Thats all buddy you are done
Hope this would help you buddy
Kindly try this and let know for any queries
Cheers @blend

2 Likes

Hey first, thanks for the description. Do you have a sample.xaml?
I am stucking in the 2nd step.

Thanks:)

Unfortunately i cant upload files as a new user.