Read Data From One Excel and Write That Data Into Another Excel With Different Column Name

Hello Everyone,
So, my scenario is to read an excel file and write that data into another excel with different column name.

@Tushar_Gupta1

Do you want to change only column names ? And also do you want to write all columns in the same order as it from original file ?

@Tushar_Gupta1 There possibly might be two ways of Performing it.

  1. Having a Excel Template ready with Headers.
    When using this Approach have an Excel File Ready with the Header Names present in it in the First row.
    After that You can use Read Range Activity to Read the Data from the Excel file as a Datatable.
    Then you can use Write Range Activity and specify the ExcelFile Path of the Template created. Use the Output Datatable of the Read Range as the Input for this Activity and UnCheck Add Headers. Specify the Range as “A2”.
    It Should work.

  2. Changing the Column Names in Datatable.
    You can Check this Workflow for that, but for this the Array of String used should contain the Names in the Order of the Datatable names that you want to replace with. Also the Array values Should have the same number of items as the number of Columns in the Datatable.
    Change Column Names In Datatable.xaml (6.7 KB)
    This is just a Template.

Also you can check with this Activity :

@supermanPunch and @lakshman Thanks for the reply but my scenerio is little bit different…So, I have two excel files in excel1 I have all the data with it header name and in excel2 i have only header name which is totally different from excel1 EXAMPLE in excel1 data is at Column No 4 and name is ‘Category’ so i want to enter that data into excel2 at Column No6 whose name is ‘Accounnts’.

Hope this information will help you to resolve my problem

Can anyone help me out from this situation?

@Tushar_Gupta1 I think your Scenario is not about changing column Names then :sweat_smile: ,Can you please provide Sample Data and the Expected Output that you need. We may be able to understand better in that way .

Hi @Tushar_Gupta1,

Why don’t use the copy past activities. like below.

  • Copy the range as column like “A:A”
  • Paste like

Regards
Balamurugan.S

So I want write ‘ACT_CLIENT_VALUE_DATE’ Column’s data to ‘Transaction Date’ and so on.

@balupad14, sure I’ll try this…

1 Like

@balupad14 Not Working…

Check this video .

I have explained

  • how to copy paste data inside excel using uipath studio
  • how to copy paste data one excel file to another excel file using uipath studio
  • how to convert the clipboard data to datatable.

Thank you
Balamurugan.S

1 Like

@balupad14 Getting this error “Exception from HRESULT: 0x800A03EC”, although i kill the process, after that I’m getting this error.

can you share your workflow please …

This is my FileMain.xaml (6.4 KB)

Hi,
The problem is the range for both activities.

  • CopyTo Clipboard’s range should be like

  • Paste Clipboardp’s range should be like

Thank you
Balamurugan.S

@balupad14 As you can see I don’t want to copy header name from ‘MIS’ and I want to write data After the header in ‘BRS’, is this possible to do so?
I’m getting the same error in paste clipboard, any suggestions?

Hi @Tushar_Gupta1,

  • Use the find last row in sheet for the copy to clipboard
  • you can specify range as “A1:A(last row index)”

-in the Paste to clipboard specify only “D4”.

Thank you
Balamurugan.S

1 Like

@balupad14 ThankYou for the solution…

1 Like

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