How to Get the Highest Value from one Excel File and input into another

Hi Anybody i would like to inquire that as i am new in UiPath am tasked to get certain historical data from a certain stock in an Excel File to input into another taking the highest value. How Do i do that anyone can help real quick thanks.

1 Like


Welcome to the UIPath Community.

Do you mean you want to read max value from particular column in Excel file ?

  1. use Read Range activity to read the data from excel file and store result in DataTable and say “DT”.
  2. Try below expression to find max value from excel column
    int MaxValue=Convert.ToInt32(DT.AsEnumerable().Max(Function(row) row(“ColumnName”)))
  3. And then use Write Cell activity to write into another excel file and make sure it should be inside Excel Application Scope activity.
1 Like

Hi @BalaKrishinan

Use this

dt.AsEnumerable().Max(Function(row) row(“colname”))

Thanks Ashwin.S

Thanks Brother for the Write Cell will be the input of where i wanna write it?

1 Like

Thanks brother will try!


As I said in earlier post, after finding max value store it in one variable of type Integer and say maxValue.

In Write Cell activity specify like below:

Sheet: “Sheet Name”
Range: “A1” ( If you want to write output in A1 cell)
Value: maxValue.Tostring

Main1.xaml (5.2 KB)

Use this. Mention the file and cell name where you want to write the maximum value.
Hope this helps!


Ok thanks for the help but the error encodes “Input string is not in the correct format”


Could you please send me workflow and excel file and send to me. Will check and update you.

Hi what is “Data”

Sorry i cant send as they say i am new Screens41 hots




Did you get Max value from High column or not.

Hello @BalaKrishinan
use this code in an assign activity
For better understanding download this workflow
UsingMaxFunction.xaml (5.9 KB)
test.xlsx (9.8 KB)

Data is ‘Column Name’, you can replace it with the column you want.

Hi @BalaKrishinan

You can use this component to easily get the maximum value of a data column.

use the DataTable Consolidate activity.
You can refer to the documenation attached to understand how the inputs should be provided.

This is a sample which I created using the same activity for another purpose which uses Sum. You can understand the usage of it using this.

DataTablePluginsTest.xaml (7.2 KB)

1 Like

Thanks a lot.



when i do that, getting this error:

but my variable is already int32. I don’t get it