Md_Hidayat
(Md Hidayat)
December 27, 2021, 11:54am
1
Hi all,
I have an excel that outputs as attached.
InsertValueForEachCell_In_ColumnC_Updated.xlsx (10.0 KB)
Is there a way to insert a text string for example, = “200” in column A for each row in Column B that has some data?
The datatable would start from A10 to C109.
The number of rows output is dynamic.
This would mean row 109 = last row is dynamic.
Thanks in advance
Regards
Hidayat
1 Like
Hi
Welcome to uipath forum
Hope the below steps would help resolve this
Use a excel application scope and pass filepath as input and use a read range activity and get the output as dt
Now use a FOR EACH ROW activity and pass dt as input
Inside the loop use a IF activity with a condition like this
NOT String.IsNullOrEmpty(CurrentRow(“ID”).ToString.Trim)
If true it goes to then block where use a assign activity like this
CurrentRow(“Status”) = “100”
Note : if you want append 100 to the existing value in column B then mention like this in assign activity
CurrentRow(“Status”) = “100” + CurrentRow(“Status”).ToString.Trim
This can handle any dynamic number of rows
Cheers @Md_Hidayat
1 Like
Md_Hidayat
(Md Hidayat)
December 27, 2021, 2:54pm
3
Thank you for the solution!
It works but I decided to go against using it in production due to the concern of this performance. By using If Else to write lines it took me around 5mins, due to the number of records in needs to go through.
Here is what I did instead.
As my output table is generated from PowerQuery, I build an additional Custom Column in PowerQuery where [Status] = 100.
Once the output table is generated I created an assignment in UiPath for Status.
Assignment_Status =
ColumnAlltable.DefaultView.ToTable(false, ColumnAlltable.Columns(“Status”).ColumnName )
Once the assignment is created, I simply use ExcelWriteRange to do a paste operation from “A10”, where column = Status
Total time for this alternative solution less than 10 secs.
system
(system)
Closed
December 30, 2021, 2:55pm
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.