Copy excel data from one workbook to another excel workbook

Hi,

I am trying to copy excel data from one workbook to another excel workbook. What is an effective way of doing this?

e.g I want to copy data from workbook a and also have the ability to specify the range A1:C2 (included as an attachment) into workbook b.

I’m a novice with uipath and code so any help would be greatly appreciated.

Cheers,

Jeff

Workbook A.xlsx (8.5 KB)

Hi @JeffNZ,

use read range activity to get the data into datatable(dt).
after that use write range activity to write the data into new excel sheet.

Regards,
Arivu

1 Like

@JeffNZ
please refer this link

HI @JeffNZ,

You can easily do it with two activities in UiPath Studio…

in order to read the excel sheet, you can use Read Range activity. If you do a search for this you will have two activities in the same name… One is under Excel and one is under Workbook

If you want to open the excel sheet and do the reading, then you can use the Read Range under excel. If you want to read the excel without opening it in your screen, then you can use the Read Range under workbook :slight_smile:

In either one, there is a property to set the range you want to read data from. There you can specify which columns and which rows should be included for the reading.
The reading will add the data into a Datatable variable. You can specify that in the Read Range activity, output property.

Next, you can use the Write Range activity. Again its same as the read range. As the input for the Write Range, you can specify the datatable variable you created for the Reading

Hope it helps!!

Let me know how it goes for you!!

Also if you have some column names as empty you have to use Read range activity with “Add Headers” disabled so that the first row won’t be considered as the column name and you will get exactly what it is. Then while writing it to another sheet use “Write Range” activity with “Add Headers” disabled.

Hi Lahiru,

Thanks so much for your response. I tried to use the read range under excel as the file I am reading is already open. That seems to work fine. I encounter a problem when I try to write range into another workbook. This time I used write range under workbook because I am happy enough for the data to be copied without opening the file.

The error I get is saying that the process cannot find the workbook to write to because it is being used by another process.

Many thanks in advance.

Jeff

470000 - Income Received in Advance- Dec 18 (RPA Demo).xlsx (8.0 KB)
470000 - Income Received in Advance Reconciliation Process.xaml (15.7 KB)
RPA GL Transactions_5oexmzor.xlsx (19.8 KB)
Write Range Error Message.pdf (160.1 KB)