Write value in cell dynamically

Hi ,

I have excel file with this data , i want to get the highest marks and lowest marks and updated in status. as highest and lowest

image

dt.AsEnumerable().Min(Function(row) row("Marks")).ToString

i can get the value but how i can update in excel dynamically ?

@Dev2

After getting Min and Max value from that column then use LookUp DataTable activity and look for that min and Max values in the Excel files and it will give output as Matching cell number.

For Max → It will give output as B5. so you need to update in C5.

For Min → It will give output as B4. So you need to update in C4.

Hi @Dev2
create 2 variables
var strMax=for max value
var strMin=for Min value

take “for each row” activity
in the body take “if” condition
conditoin>> row(“Marks”).tostring = strMax or row(“Marks”).tostring = strMin
in the “if " body take one more” if "conditon
conditon for 2nd if >>row(“Marks”).tostring = strMax
in Then>>use Assign>>row(“status”)= Highest
in Else>>use Assign>>row(“status”)= Lowest

Hi @lakshman


Thank you but i need dynamically cell because all times will be change

Hi @VIDHATHA_THADURI

Thank you but how i write dynamically cell in excel ?

first, use read range to read the entire data
then do the above process using a data table variable
then write again back to the same excel sheet using write range & Don’t forger to check the headers

1 Like

@VIDHATHA_THADURI

i get this error

Age.xaml: Compiler error(s) encountered processing expression “row(“status”)= “Highest””.
Option Strict On disallows operands of type Object for operator ‘=’. Use the ‘Is’ operator to test for object identity.

Hi, @Dev2

please find the soluton xlsx below…

Main.xaml (11.1 KB)
New Microsoft Excel Worksheet.xlsx (9.3 KB)

sheet 1 >> input
sheet2 >> output

1 Like

Thank you @VIDHATHA_THADURI

it is working

@Dev2 thanks for the code actually…:wink:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.