How to get the excel file name which does not have data based on my filter?

I read the data from 5 excel files using this: allFiles = directory.getfiles(“My files path”).
And then filtered data using filter datatable. I inserted the sorted data into separate file.
Now how do I check which file from 5 files does not have data based on my filter data table. If any of file does have data according to filtered condition, I need to get the name of that file & insert that file name into empty sheet.

Thanks

After filtering data table, check the filtered data table contains any rows or not.

numOfRows = filteredDT.Rows.Count

if numOfRows = 0 Then
//insert file name into sheet
else
//inserted filtered data

Regards,
Karthik Byggari

1 Like

Hi @KarthikByggari, thanks for your help.
As I got all files like this: allFiles = directory.getfiles(“My files path”)
How do I get the name of that specific file out of 5 files which does not have data based on my filter?

Thanks

iterate those files in For each

In that Use Excel Application Scope
 Read Range  ---  DT1
Then Apply filter you want and store  it in a var say DT2
then Use If 
DT2.rows.count=0
Then Add to collection---> Item will be item.tostring

Note : Initialize Collection As New list(Of string)