Can anyone help me to provide solution for below query?
I have a excel sheet with data and where I need to update few column values after filtering. Using assign activity I can update required column values but then I need to use add row which in this case not required so how can I achieve this?
Here is the example:
Input DataTable: MasterDT
Column1 | Column2 | Column3
UiPath | Studio | Community
UiPath1 | StudioX | Orchestrator
FilteredMasterDT by Column1=“UiPath”
Column1 | Column2 | Column3
UiPath | Studio | Community
Here I want to update value for Column3 in the FilteredMasterDT datarow but it should reflect in MasterDT, so how can I do this as I don’t know the row index of the given row in the MasterDT.
Also after updating the value for the given row of Column3, how it will reflect in excel as I did not add any row?
Need below output:
Output DataTable: MasterDT
Column1 | Column2 | Column3
UiPath | Studio | Academy
UiPath1 | StudioX | Orchestrator
No need to use Filter Datatable
Just
Use if condition
In for Each Row
IF row(“Column1”).ToString=“UiPath”
Then
Row(“Column3”)=“Academy”
else (Here u can again add if condition if there are multiple)
Row(“Column3”)=“Orchestrator”
After For Each Row Use Write range (Note : Dont forget to tick add headers)
Forgot to mentioned that, I am able to update the row but while writing to excel using Write Range with add headers, it not showing headers.
I am reading excel with headers which I have to do as its needed and after updating required column value and I am writing it. Here its not showing headers.
If you know the column name, then after you filter the data you can just read the cell addresses and replace the value with the new one, using a for loop for that column(in which you want to change the value) until you get the blank cell in that column.