PDF file name comparing with Excel contents


I have a list of PDF files where the file names are IDs of the employees and an excel file which contains the list with Employees along with their IDs.

I want to compare each PDF file names (ID) against the IDs in the excel to retrieve the employee name of each IDs, and rename the PDF file as “ID-Employee name”

Could you assist me on how to achieve this.

Thanks in advance

Hi @Aishwarya ,

- For each file you can try this ( add For Each as well )

  1. Read file names from excel into a datatable (ReadRange activity)
  2. Search the PDF file name in the datatable (Lookup Data Table activity)

- Also, I add another suggestion and hope it might help you:

Follow below steps:

  1. Assign an array variable(say Files) to Directory.GetFiles(“FolderPathWherePdfFilesAreStored”)
  2. Use read range activity and store your excel data into a datatable variable(say dt1)
  3. For each row in dt1
    For each File in Files
    Assign a string variable(say Name) = row.item(“ID”).tostring() + “.pdf”
    if(File.substring(File.LastIndexOf("")+1) = Name)
    Assign a string varialbe(say NewName) = row.item(“ID”).tostring() + “-” + row.item(“EmployeeName”).tostring() + “.pdf”
    Use move file activity with the properties as below:
    from: File
    To: File.replace(Name,NewName)
    Place a break activity here

For ID, EmployeeName are the column names of the excel file or replace them with whatever column names you like

1 Like

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