How to copy one sheet in one Excel file to a sheet in another Excel file with UIPATH

Hi, all, I am a new user of UIPATH. Could anyone share me a sample how to copy one sheet in one Excel file to a sheet in another Excel file with UIPATH?
Besides invoke VBA macro, is there any other activities to support this ? Thanks

1 Like

Hi @Jim_Yang_1117

We can try with read range and write range activities!

Regards

HI @Jim_Yang_1117

You can follow this steps

  • Use excel Application Scope
    • Read Range, pass your sheet and store in the DataTable
  • Use another excel application scope and write range activity inside that Write Range and pass the DataTable you created above and pass your sheet. And give different File location

Like this

Find Xaml skeleton for your ref
Sample.xaml (7.1 KB)

You can also look on the thread for ref

Regards
Gokul

Hi @Jim_Yang_1117

And also have a view on thread below!

Regards

1 Like

Thanks, @pravin_calvin , i think it may be a solution, but it needs to read to datatable parameter first and write datatable to destination position. Is there any other activities to simulate Excel operation , such as

  1. Open file1, select sheet1, ctrl+a, ctrl+c
    2 Open file2, select sheet2, ctrl+v

Hi @Jim_Yang_1117

We can try with excel application scope!

Regards

@Gokul001 , Thanks, although the solution is not i expected, i can try this. Let me try it first.

Hey @Jim_Yang_1117 !! Welcome to the automation world!! :tada: :mechanical_arm:

Here is your sample!

  • Step 1: First of all let’s get our two worksheets. I will use “Test1” which contains the following data.

And the excel “Test2” which is empty and is where we will paste the data from the worksheet “Test1”

  • Step 2: Well, to start we need to include the “Excelp Application Scope” activity so that we can use an excel file. Look:


    We passed the path in the field of “Workbook Path” and the properties can be left as in the photo, but it is worth studying and exploring later!

  • Step 3: To read the data from an excel spreadsheet, let’s use the “Read Range” activity.
    image

Attention here!! We have two Read Range activities. “Excel” and “Workbook”. When we use “Excel Application Scope” we will use the first one, from “Excel”. Then look up the difference between the two.


To store an excel table in our code, we need to create a variable of type “DataTable”. Look:

Pass this variable in the “Output” of the “Read Range” activity.

  • Step 4: As in reading, we are going to use “excel Application Scope” but we are going to use excel’s “Write Range” activity. Watch:

Files:
Main.xaml (10.3 KB)
Test1.xlsx (8.7 KB)
Test2.xlsx (9.6 KB)

Hope it helps!!

1 Like

Hi @Jim_Yang_1117

Okay then for using Send hotkey activity

Have look on the document and video it may help you

Or else you can also try with copy\paste range or copy sheet activities

Regards
Gokul

Hello @Jim_Yang_1117

Can check the below video

Thanks

Hello Gokul, is this working with an image on a sheet excel file? Thank youu