Validation of For each file Name and data in the DT

Hi,

I have an excel file where I have stored the invoice file names and I have invoice files in a folder.

Now I want to validate the files with the names in the excel. If the names and files matches(exists) then I want to append to “Yes” against the Name in the excel, if not append “No”.

can anyone please provide the solution for this.

Thanks in advance

Hi @raju_alakuntla

Can you try below

System.IO.Directory.GetFiles("C:\Users\lrtetala\Documents\UiPath\BlankProcess23\Input").Any(Function(file) System.IO.Path.GetFileNameWithoutExtension(file).Equals(CurrentRow("FileName").ToString))

Input:

A spreadsheet with two columns titled "FileName" and "Status," listing item names under "FileName" but leaving the "Status" column blank. (Captioned by AI)

Output:

The image shows an Excel spreadsheet with two columns labeled "FileName" and "Status," containing a list of files with their corresponding status marked as either "Yes" or "No." (Captioned by AI)

Regards,

1 Like

@raju_alakuntla

As you need the status on excel instead of reading and doing on datatable and writing use for each row in excel so that the status gets to excel directly

cheers

Step-1: Read excel file into a data table
Step-2: Store invoice filenames into an array of strings
Step-3: for each row in data table
if arr_InvoiceDetails.Contains(row(“File”).ToString),
then writecell status as “yes”
else writecell status as “No”

Attached is the solution for your reference.
FindInvoiceName.zip (510.1 KB)

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