Excel based task

Hi Guys,
@ppr @srishsai
Can you assist me?

  1. read excel file (datatable1)
    2.copy specific column
  2. Paste into another excel file to specific column

Example;
input datable1:
name,id,product
abc,23, test
abc2,33,abc2

output excel:
image

output excel have a prebuilt template with header.

Please assist me.

@Sneha1
have a check on following flow suggestion:

  • read range (input) - dtData
  • add value column to dtData
  • change/edit the value column position in dtData
    • setOrdnal method with an invoke method OR dtData.DefaultView…
  • write range dtData to template worksheet
    • tick off addHeader, set an offset to range e.g. E2

thank you for quick response. I want to add many columns then how many write range i will use?
so without write range any other suggestion?

keep in mind write range is writing all data, so it is not a cell wise writing

@Sneha1

Your example is not enough. Kindly add sample input in one sheet and the expected result(How you want the data) in another sheet.

Also, Elaborate on what solution you are trying and what issues you are getting.

If you haven’t done certification then I suggest going through it for excel automation and data table chapters.

Hi @Pravin_Patil1 and @ppr
I have attached input and output. Please check itinput and output.zip (12.7 KB)

No attachment

@Sneha1,
Hope the below steps will clear your doubts.

  1. Read source excel sheet(S_DT) and destination sheet(D_DT) using 2 separate read range activities.

  2. Find the column indexes of required fields in destination datatable (in D_DT)

  3. Loop over the Source Datatable(S_DT) and use Add Datarow Activity in it to add/append new rows to the D_DT.

  4. Write range it to the destination excel sheet.

Regards,
Poorna

shared

@Sneha1

  1. Use build data table activity and build the table with expected columns
    https://docs.uipath.com/activities/docs/build-data-table

In your case → sl no sl code amount name value product id

  1. Then use for each row after reading sheet1 and getting into data table

  2. Use add data row inside for each body and pass the values using array property of add data row.
    https://docs.uipath.com/activities/docs/add-data-row

In your case array will be like
{"","","","",row(0).ToString,"",row(1).ToString,row(2).ToString}