Question on adding on entries into another excel

Hi all, I would like to ask a question regarding adding on data to an excel from another excel.

I am trying to add a row of data to the output excel, however the columns of the excel do not match. For example in the Input excel, the column name 'Vendor" is in column 1, but in the Output excel it is in column 10.

Could I somehow do a make datatable and add the data respectively?

Thanks

Hi,

Can you share specific sample data (input and output)? It’s no problem if dummy data.

Regards,

Hi there, here is an example

Hi,

Thank you for sharing. But where TransactionAmount comes from, for example? Can you clarify input data? Are there 2 input sheets?

Regards,

Hi,

Some of the data from other columns are derived from the Input folder (E.g. adding 2 columns from the input sheet). There is only 1 input data.

Try using column headers rather than using column number
Or get the index of the columns u
For eg:
Put for each loop row activity and iterate through rows using column headers
Assign
- CompanyIndex = dtOutput.Columns.IndexOf(“Company”)
-EmployeeIDIndex = dtOutput.Columns.IndexOf(“EmployeeID”)
- SurnameIndex = dtOutput.Columns.IndexOf(“Surname”)
-AddressIndex = dtOutput.Columns.IndexOf(“Address”)

    - newRow(CompanyIndex) = row("Company").ToString()
    - newRow(EmployeeIDIndex) = row("EmployeeID").ToString()
    - newRow(SurnameIndex) = row("Surname").ToString()
    - newRow(AddressIndex) = row("Address").ToString()

Hope This helps!

HI,

Can you try the following sample? This re-order column of datatable.

arrColumnName = {"Landlord","Company","Surname","Lease Start","Lease End"}

then

dt = dt.DefaultView.ToTable(False,arrColumnName)

Sample20230719-2L.zip (8.5 KB)

Regards,

1 Like

Hey there,

I was thinking of doing it this way, and your answer has reassured my thinking :sweat_smile: Thanks!

1 Like

Hi,

Thanks for your help, I will give this a shot

Thanks you!

You’re welcome! I’m glad to hear that my answer has reassured your thinking. If you have any more questions or need further assistance with anything else, feel free to ask. Happy automating with UiPath! :grinning:

1 Like

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