How to extra filenames and check these files exists in excel if not it should enter file name in the excel

Can anyone help me how to extract file name with extension from a folder and check extracted file name in excel. if not exists then it should enter the file name in Column A and in column B update as “Pending” please refer my screen shot below.


I don’t know how to write condition for this pls help me

Hi @tkiran ,

Kindly refer to the attached SolutionCheckWhetherFileNameMatches.zip (8.9 KB)

File extract.xaml (15.9 KB)
i have tried but some where i am missing can u pls help me out i have attached file

The code looks fine, what is the issue you are currently facing.

image

image

In the code shared with me there is no such errors


Click on edit arguments and check whether you have created PDT and binded it as well.


pls check this arguments

Looks fine, check whether Private property is set.

Well, My approach would be bit different.

  1. Read excel file in a DT.
  2. Get file from folder in a list
    listFile=Directory.GetFiles("FolderPath")
  3. for each item in listfile
    if((from dr as datarow in DT where dr.item(“Column A”).ToString.Contains(path.GetFileNameWithoutExtension(item.ToString)) select dr).count>0)
    {
    }
    else
    {
    Add data row ({path.GetFileNameWithoutExtension(item.ToString),“Pending”})
    }

File extract.xaml (18.7 KB)

Can you pls correct in this if possible or send me your above code in uipath screenshot.

1 Like

File extract.xaml (9.7 KB)

Here we go

WOW… Superb… thank you so much it works perfectly…

1 Like

@tkiran Great it helped you.
Please mark it as solution and close thread.

Hi @Lakshay,

Good to know about your though!
The logic is still the same, the only difference here is parameter is interchanged & loop is avoided since it might affect performance.

1 Like

@shivagowdavarad True that. Logic is exactly same, just another way of doing it.

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