If the excel is blank

i have if else and if my excel have data then execute if part and if my excel doesn’t have data then go to else and message box their is no data in excel

1 Like

Hello @nikhil.patil ,

You can perform the following steps to achieve the above :

  1. Use Read Range to read the Excel file & store the data in DataTable variable (Ex : dt_MyData)
    (More about read range : https://docs.uipath.com/activities/docs/excel-read-range)
  2. In If Condition use expression (dt_MyData.Rows.Count>0)
    put your logical part in if block.
    In your else block put the message box to print “their is no data in excel”.

Happy Automation!

Hi,

Find the below attached xmal

Excel.zip (8.5 KB)

Regards,
Dhanush

Happy Automation!

Hi @nikhil.patil
Sample.xaml (5.5 KB)
a sample created for your reference

Hope this helps you
Test.xlsx (6.0 KB)

Hello @nikhil.patil

you can use read range and read the excel, then get the data to a datatable.
then check whether the number of rows are greater than zero using. YouDatatable.rows.count>0.
Then use a if condition, if greater than zero then do the process else popup the message box.

Thanks

if Conditon else part are message box not trigger only then part message are trigger

@nikhil.patil can you send the screenshot of your excel file.

Capture

@nikhil.patil , if your excel contains any headers make sure you have checked the Add Headers in your Read Range activity, else it will be counted as data & DT1.Rows.Count will never be 0.

excel data are empty and check if condition empty are not then send mail then part and check condition write and worng dtData.RowCount<>0