anmita
December 9, 2022, 4:27pm
1
How can we update specific cell value based on other two fields
Username |LastName| Oct |Nov | Dec
Anita | Jha | 20.05 |30.6| 90.8
So how do we update if name =“Anita” and Month=“dec” it should update the amt in Dec column(cell) as 90.8
Anil_G
(Anil Gorthi)
December 9, 2022, 4:35pm
2
anmita:
column
Hi @anmita
Perform following steps
Use excel scope to open the files
Use for each row in excel to loop through rows
Inside for each use a if condition to check the conditions Eg:
Currentrow("Username").ToString.Contains("Anita")
In then use a assign activity to set the data
currentrow("Dec") = "90.8" or 90.8
If data is in datatable do the same with for each row in datatable and no excel is needed
cheers
anmita
December 9, 2022, 5:45pm
3
Hello @Anil_G
Thanks for reference
Is there any other approach to update based on index values of row and column?
Anil_G
(Anil Gorthi)
December 9, 2022, 6:25pm
4
anmita:
=
@anmita
So
Use the same for loop
But assign would be
Assuming month is stored in a variable(Month)
CurrentRow(Month) = 90.8
2.Read the excel data into datatable(dt)
then
Assign (Row index is String type)
RowIndex = dt.Rows.IndexOf(dt.AsEnumerable.Where(function(x) x("Name").ToString.Trim.Equals("Anita"))).ToString
Assign (ColumnValue is String Type)
ColumnValue = chr(65 + dt.Columns.IndexOf(Month))
Use write cell
With cell value = ColumnValue + RowIndex
Cell data = 90.8 or “90.8”
For row index you can also use
Rowindex = dt.Rows.IndexOf(dt.Select("[Name]='Anita'")(0)).ToString
Hope this helps
cheers
cheers
Hello @anmita you can directly update like below mentioned type or else you can also use linq
dt.Select(“[Username ]=‘Anita’”)(0)(4)=90.8 or"90.8
1 Like