Matching the PD files names again Excel

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

So I would like 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”

Would it possible to do that? Please assist

Yes. This can be automated.

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
    }
    }
    }

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

1 Like

thanks for your suggestion, I will give it a try

1 Like

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