Excel Read last column and check if value is =0

Hi

I have a number of files inside a folder i need to open each file and check if the last column value = 0 or not. Any clue how to achieve it. I am new to uipath.

Hi , You mean last column of last row ?

Yes exactly, i need to check if the value is 0.00 as given in the screenshot.

First use
‘For each’ activity
for each of Directory.getfiles(Folderpath)
The argument type should be ‘String’
Then inside body of the for each loop
Use Excel application scope
Then inside Excel application scope , use Read range to read the excel file
Excel file path give as ‘Item’
Now create a datatable variable ex:DT1 , and give this DT1 as output to Read range
Create a Int variable ex:Rowcount
Now use a Assign activity
Rowcount = DT1.rows.count

Create another generic variable ex:Value
Use assign activity
Value = DT1(Rowcount)(Last column name)
Now use a if condition to check
If
Value.tostring = “0.00”
Then
You can write whatever you want to write if it is 0.00

Hope this helps:

DataTables.Rows.Count gives you the count of the rows in the data table. Assign this to a variable say RowCount.

If:
Convert.ToDouble(DataTables.Rows(RowCount-1)(<>).ToString) = 0.00

Then
<>
Else
<>

1 Like

Could you please tell me how to write this one. i am getting error while writing it.

Try using:
StrVar= if(dt(dt.rows.count-1).item(yourColumnName)=“0.00”, “Yes”, “No”)
It will return Yes if it’s 0.00 else it will return No

The column has got variable name. can i assign column name instead? For eg it is the F column.

You can use it as below as well:
StrVar= if(dt.rows(dt.rows.count-1)(dt.columns.count-1)=“0.00”, “Yes”, “No”)

Here we don’t have to use column name

@Ankita_Biswas_SDC_Ko,

Check this xaml, it may help you with this requirement. I have written the output to a text file, change that as your want. Before running it change the input directory and then try.

CheckAllExcelForValue.xaml (9.6 KB)

Hi , What is the error you are getting ?