Moving a sheet from one excel to another excel

Hi – I want to move one sheet from a excel file to another file. I use 2 excel application scope – One for read range and another for write range. It executes successfully, but i am not getting the same format from the original file. It is pasting as values and need the same format to the 2nd file. Can you help me on how to move the sheet to another?

@Subram As read range stores the data in Datatable, you cannot maintain the same format of the excel file. You follow below steps in order to delete a sheet from excel:

  1. Make a copy of the original file by copying the file to some path.
  2. Delete the sheet by using Ui-Automation on the excel.
    – as you would already know the sheet name which needs to be deleted, use “Ctrl+g” hotkey on the excel file to go to the sheet.
    – type “Sheetname!A1” in the “Go To” Window (which comes after you hit "Ctrl+g)
    – Click on Home-> Delete->Delete Sheet. (Please find attached screenshot for this).

Thanks for your response :slight_smile: But still i am not able understand . I already created a folder in a path and have 2 files in the folder. All i want is i want to move one particular sheet from file one and insert with same format in file two. Sorry if you have already answered this, but still if you can explain further it would be great

Hello @Subram,

can you just execute below code if it suites your match then merge it?
Main.xaml (14.2 KB)
Report.xlsx (8.7 KB)

Thanks,
Pankaj

Getting this error. I have saved the file in my computer and executed it

Hello @Subram,

could you please send/attach an error that will be shown on console in read color?

Thanks,
Pankaj

here you go

Could not find member ‘CreateNewFile’ in type ‘http://schemas.uipath.com/workflow/activities:ExcelApplicationScope’. Row: 72, Column: 57

Hi @Subram,

You want to move excel sheet from one sheet to another sheet or
one excel file file to another excel file

I want to move One sheet from Excel file A to another sheet In Excel file B

Hi @Subram,

kk
Please find the attachment of solution

Its easymove from one file to another file.xaml (7.4 KB)

2 Likes

Thanks – This is easy and i know this :slight_smile: My question is i need the same format from the original sheet. but this query paste special values

I have attached the screen shot of the format. but while pasting the colour goes off

image

Hi @Subram,

using copy file activity we can get that
chk it once
I got the file exactly with color

Copy file will copy the whole file, but i need to copy only the sheet.Eg total 3 sheets in a file and i need to copy only one sheet amd move to a difference excel file

Hi @Subram

May be a macro can solve the problem,such like :

Sub MacroCopySheet()

    Sheets([target sheet]).Select
    Sheets([target sheet]).Copy Before:=Workbooks([destination workbook]).Sheets(1)

End Sub

You can try this,and let me know if it works.

Regards.

Hi @lainh,

yes its good idea
We can do using macros

you are experts :slight_smile: but i am not!!! Please send me an excel file with a macro and i can edit the sheet name. plssssssssssssss

Hi @Subram

Please check the attachment file.
I upload one set of the sample:
1.the xaml (to use it you should rewrite the [excel.exe]'s and the excel files’s path)
2.the target excel
3.the destination excel

CopyExcelSheet.zip (20.2 KB)

Please try it.

What action u used in the below? its not appearing

image

Also tell me the macro name – i think you used execute macro