Adding Data Column Without Running Excel Client

Hello everyone. I have a question. I want to add the column I took from one Excel file as a column to another Excel file. But I do not want to run the Excel clients while doing this. How can I do that ? Can I use Database activities for this ? İf yes, How can ı do this ?

Hi welcome to community !

image

You can add the column by using the “Add Data Column” Activity so it will add the column to excel with out run the Excel clients while doing this

@Ali_Osman_Kaya

Hi
you can do this with workbook activities as it runs even when excel is not installed

Hope the below steps would help you resolve this

  1. Use a workbook read range activity and get the output as a datatable named dt1 and same read the other excel also with workbook read range activity and get that as dt2

  2. Now use a ADD DATACOLUMN ACTIVITY where pass dt2 as datatable and datacolumn as dt1.Columns(“columnname”)
    Or
    dt1.Columns(column index) where column index starts with 0 for first column and you can use this if u don’t know the column name or duplicate columnnames

  3. Then write back to excel 2 with WORKBOOK WRITE RANGE activity with add headers property enabled

Cheers @Ali_Osman_Kaya

Thank you. Can ı do it by using database activities (one of them is insert activity) ?

But if I use read range activity, excel clients run. Is not it ?

That read range is from excel package
Search as workbook in ur activity panel it will show the same set of activities as in excel package

Workbook activities doesn’t rely on excel application

Cheers @Ali_Osman_Kaya

Yes, the “Add Data Column” activity is part of the Database Activities package in UiPath. This activity is used to add a new column to a DataTable, with out run the Excel clients while doing this

Hope it will help for you let me know if anything

@Ali_Osman_Kaya

If you search add data column in activity panel you can find it

@Ali_Osman_Kaya

I will give an example to make the problem more understandable and to explain its scope. Imagine you have 2 Excel files right now. In one of these files there is a column titled “name”. I want to add this column to the other Excel without running the Excel client. Can you explain this step by step? Without using Excel or workbook activities.

Well there are activities to do it
But when u r using any activities under excel it will run excel application in background

https://docs.uipath.com/activities/other/latest/productivity/manage-databases-in-excel

So u can use workbook activities only to avoid running excel clients and manipulate it mean time
If it’s fine run it in background then ofcourse u can use the above package

@Ali_Osman_Kaya

After using the “Connect to database” activity, I pulled my data set using the “run query” and “output datatable” activities respectively in the Excel I connected to. But things get complicated after that. I use the Insert activity under Database to add the data I received to the other Excel, but “Insert: Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information.” I’m getting this error. I can’t fix it anyway. I think if it is successful in this way, I will be able to complete the process without running Excel client.

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