Hello Every One i have the following problem:
I have a String: tmp_MyString = “2298,1936,2316,2092,1948,2247,2255,2736,2735,2908,2904,2885”
Now i have to add this string to another datatable under a specific Column “Kamapgnennummer” in each row like following
How can i do this ??
Thanks in advance
Convert the string to a list. For Each loop through the list and Add Row each value to a datatable. Then use Write Range to write the datatable to the H2 range.
@postwick Thanks for quick Response, But the H2 Range is not fixed , it will keep changing
I mean the Column “Kampagnennummer” might be shifted to some other range like I J K L etc as well
That’s why it’s a range. You can just designate the starting cell and it will write as many rows as it needs.
Then you need to account for that and provide the correct range to the Write Range activity.
Hope the below steps would help you resolve this
Initially use a excel application scope and pass the file path as input and inside that scope use the below activities
- Use a assign activity like this
arrvalue = Split(tmp_MyString,”,”)
Where arrvalue is a variable of type Array of string
Now use a excel application scope and pass the file path as input and read the data with read datatable activity and get the output as dt
Now use a assign activity like this
Str_position = Convert.ToChar(dt.Columns.IndexOf(“Kamapgnennummer”)+65).ToString
Where str_position is a string variable
- Again a assign activity like this
Counter = 0
Where counter is a int32 variable
- Now use a WHILE LOOP like this with a condition
Counter < arrvalue.Count
- Inside the loop use a WRITE CELL ACTIVITY
Where mention the cell range like this
Str_position + (counter+2).ToString
And in input value mention as arrvalue(counter)
- Next to this write cell activity inside the while loop use a assign activity like this to increment the counter value
counter = counter + 2