Hii,
I have to write the data to excel using write range activity but the column under which I have to paste the data is not having its cell number fixed.
So I need to use the column name to paste the data.
How should that be done ?
Can anyone suggest me please?
Get the cell reference of the column with find/replace activity and then increase the cell reference which will be provided to target range
HI @Kunal_Jain
If ur process is inside the For each row in datatable
You can use a assign activity to update the data in the datatable
Like in assign
Left Side = CurrentRow(“ColumnName”)
Right Side = “Your required string data”
This will be updated directy in the datatable
After looping all the data if you use write after for each roow in datatable your data will be updated completely in the Excel file
Regards
Sudharsan
Follow the steps
- Read range Activity into dt
- Now get the array of columnnames from the datatable
(From dc In dt.Columns.Cast(Of System.Data.DataColumn) Select dc.ColumnName).ToArray()
and store in in a string array strarr - Use for loop on the string array as input argument and change type argument to string and assign a variable to the index property in for loop properties
- Now use invoke method inside the for loop to set the ordinal or the datacolumn which is dt2(the data which is to be pasted) …
Index is from the forloop properties…target object dt1.Columns(CurrentItem)
This will convert the columns in same sequence as the excel you want to paste
so you can use write range now to paste the data
Hope this helps
cheers
Hi @Kunal_Jain ,
Could you let us know what exactly you would want to perform with an Example, also maybe providing Screenshots of your Sample Input Data and Output.
This would help us clear the clarifications that we have regarding the problem statement.
This is the normal scenario
I have to write the data to
Actually the cell should not be used to write the data
I have to use the column name to write the data .
Does the Datatable DT
have only one column data or does it contain data of all other columns as well ?
Also, the Excel file to where you want to write the column data, Is it already being read as a Datatable ?
Note also that we have asked the Sample Input and Output data and not the workflow.
Datable DT has much more data but we have to write the data starting from that column.
Yes the datatable is being read.
Check the Sheet I have provided below
Here I want the data to be pasted from column name “EmployeeID”
Employees.xlsx (13.3 KB)
I believe this is the Input data right ? What should be the Output data ? Where it needs to be placed ?
In Sheet 2 the data pasted is the Output data
Actually I cannot share the actual reports.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.