Open a certain PDF file with certain "values (identifying characteristics)" that result from an Excel column

hello, i have the question, how to open a certain PDF file with certain “values” that result from an Excel column and then copy values from it and paste them into certain cells of the Excel file.

The following screenshot illustrates my intention:

I had thought about solving the whole thing with an “if condition” by saying “if the column name is equal to xy and the value of the row in it is equal to the last three characters of a pdf name inside the folder”, then “open the pdf and copy three specific values into selected cells of the row” and else "if the pdf is not found write “no” into another cell of the row. I would have to do the whole thing with a loop for all rows of the column.

unfortunately i’m still a beginner and don’t know the terms for something like that yet and couldn’t find it in the forum.

The Best way , will be :slight_smile:
Read all the pdf files in the pdf folder using Directory.Getfiles(Folderpath)
assign it to an array variable.

  1. Read the excel file in Datatable
  2. Iterate through for each row of that Data table
  3. inside of this , you can loop through the ArrayofFileName

Put an if condition with Path.GetFileName(arrayItem).ToString.Contains(row.item(“Column Name”) or Path.GetFileName(arrayItem).ToString.endswith(row.item(“Column Name”))

Also, use a break activity inside of it to exit the array loop once found

If true ,

Then use start Process to open the respective pdf file

Also, use a break activity inside of it to exit the array loop once found

regards
Vishnu

hey i have as you said read the pdf files in an array variable “FilesPdf” (step 1) and then tried to implement it with a for each row function in which an if condition is the one you explained. But there is an error in the green rectangle which says “the value of type 1-dimensional array of string cannot be converted to string”.

Now I don’t know how to fix this error and what exactly is in the if condition or what exactly is in the start process application to open the desired pdf

Sorry for the many questions and thanks for the help

1 Like

This is the error I get when I copy it exactly as described:

1 Like

You have missed a step here

You need to use a for each inside with Files-PDF and inside of it u need to put an if condition .