I am currently trying to make a very simple automation , one that would duplicate the selected column(s) from an excel file and add them to the right of the existing ones. However , as I am trying to do the basic part of it (aka adding the column) , I get an error stating that “column 1 already belongs to this datatable” , which makes sense. However , when I try to give it a name ((DTTable.ColumnCount +1).ToString) , I get the ensuing error that the overloading groups Column and Column name should not both be configured at the same time.
How could I work around that issue ?
You can use Insert Columns Activity to insert the New columns. You can provide new Name for the columns and the position. Then You can use Read Range on the required column and use Write Range to write it to the column which you newly created.
Could you provide Sample Inputs and Expected Outputs for it ?
We could simply understand the Logic faster this way and provide/suggest you a better solution.
We do understand you would want to Duplicate Column Values, but is it only a Specific Column and are we duplicating it only once or as many times as Required ?
The issue is that I am working outside of an excel app integration , as I don’t necessarily want it to be outputted in an excel file , or even as the original input , if I want it to be easily integrated into other , wider workflows later…
Thank you for the hint however !
The input is a single column excel file (for now) , and the expected output would be a two-columns one , however for a wider table , it’s placed within a for each activity , and should add a duplicate of each column at the end (which I assume is on the right) of the last existing one , effectively making a duplicate of the table on it’s right after the loop is completed , so once. As I’ve built it yet it probably will loop until I force it to stop , but that much shouldn’t be too hard to solve.
Do you want me to provide with the workflow I’ve made so far and the input excel ?
Thanks in advance ,
Bastien
After the Operation/Execution , we end up with the below Datatable :
We make use of a Dictionary to Point out the Columns to be Duplicated and How many times :
We Add a Column at the Beginning to the Input Datatable, A Key Column which can be used to uniquely Identify the rows of the Datatable, We populate the column value in each row Incrementally, this is used to Later Combine the Input Datatable with the Temporary Datatable with the Modified Column Names :
We Create a Datatable Temporary to hold the Column to Duplicate along with the Key Column, Then we change the Name of the Column to Duplicate :
You could delete the Key Column at the End, as it is used just to Combine two Datatables.