Write Data in a column with random number of rows


How to write data in a column if the amount of rows inserted is random?
Eg. I want to Write Name for ID 1234 = “TA”, Name for 2678 = “AA”, Name for 3344 = “CT”, Name for 1122 = “ST”
The data from Column ID comes from a software (Confidential) - using Open Application and Paste it in excel using send hotkey (Ctrl + V)
All this are done in excel itself


Read the excel into data table using Read Range Activity. So the data will be in datatable.
So to get the number of rows in your excel,
numRows = DataTable.Rows.Count


What does that do? I didnt get it though. I want to write out under Column Name “TA” for Column ID “1234” and so on…


Loop thru each row of Data Table.

If you know the IDs (fixed) instead of IF, you can use the switch activity.


Case “1234”:
Case “3344”

Assign Activity, intIndex = 1
For Each row in DT
         intIndex = intIndex + 1
         Id = row(1).ToString
         if id == “1234”
                  use Write Cell Activity, Range -> “A” + intIndex, Value = “TA”


Do u mind doing it in UIPath and screenshot? Here is a sample data
Random.xlsx (7.9 KB)