Error opening PDF file same as Excel character

I would like to repeatedly open PDF files with names matching the content in specific cells. Additionally, if the numbers in these cells are the same, I only need to open the PDF once. I’ve explored various methods without finding a solution. Your assistance would be greatly appreciated. The image below will provide additional details.
Thank you in advance for your help!

Hi @22222222asas

Read the excel file & store the results in the datatable


Iterate over that datatable & assign the Pdf number from datatable to a variable in this case (PdfNumber).
Use Start process to open the Pdf. Use the read pdf text if you want to read the text of that pdf.

Hope this helps :slight_smile:

1 Like

Hi @22222222asas

You can do this by getting only the unique Number value from F Column to open the PDF only once by looping on each value as Data Table or Array from the below methods (You can choose once according to your requirement)

1 Solution: To get all the unique values of Column Number (Output as Data Table)
DT.AsEnumerable.GroupBy(Function (x) x(“Number”).ToString).[Select](Function(y) y.First).CopyToDatatable

2nd Solution: To get all the unique values of Column Number (Output as Array)
DT.AsEnumerable().Select(Function (a) a.Field(Of String)(“Number”).ToString).ToArray.Distinct().ToArray

Hope this will help you.

Cheers!

1 Like

@Nawazish_Ahmad
Thank you for your response. I’m still inexperienced in development. Could you please explain it with an image or code? I apologize for any inconvenience

@AJ_Ask
Thank you for your response.
if, as mentioned earlier
, the same number occurs, should I just open one PDF and skip the others? If not, could you advise on how to proceed? I apologize for any inconvenience!

Hi @22222222asas

If the same number occurs again, We can tackal this by removing the the duplicates from the datatable. Add this Assign after the read range it will remove the duplicates from the datatable. So You will have all the unique numbers to open pdf.

dt_Main = dt_Main.DefaultView.ToTable(True)

Hope this helps :slight_smile:

1 Like

@22222222asas

For Output as DataTable

  1. Read Excel - Output DT (DataTable)
  2. Use Assign activity Save To= DT and For Value to save
    Use the below expression to get only the unique values of Column “Number” in DataTable variable type.
    DT.AsEnumerable.GroupBy(Function (x) x(“Number”).ToString).[Select](Function(y) y.First).CopyToDatatable

For Output as Array of String

  1. Read Excel - Output DT (DataTable)
  2. Create Varibale ArrString (Array of String)
  3. Use Assign activity Save To= ArrString and For Value to save
    Use the below expression to get only the unique values of Column “Number” in Array of String variable type.
    DT.AsEnumerable().Select(Function (a) a.Field(Of String)(“Number”).ToString).ToArray.Distinct().ToArray

Note: If your Number value is in Integer, then change Of String in 2nd Solution to Of Double

Hope you understand better.

Cheers!

1 Like

@AJ_Ask
Thank you very much!

@Nawazish_Ahmad
Thank you very much!

1 Like

Hi @22222222asas

Better open another Thread for this question. As your previous question is already answered!

& if my solution helped for previous question. Mark it as solution.

Thanks :slight_smile:

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