Problem in looping with Data table then append to .xlsx

Hi
I am working on a project to get some pdf files from the mail
then looping through each pdf file to extract some data

I have a problem in the loop causes repeating the process of writing data inside the Excel file more than one time

Any one could help with that?

here is a link for the project if you need to review it:

1 Like

Hi @Hossam_Gouda ,

I believe you would not need the Do While loop to loop through the different Pages in one Invoice Document, as there would only be a Single table present in one PDF document.

Try to remove the Do While loop and use the Extract Structured Data Activity and Write Range Activity from it before the Close Application.

1 Like

I would like to thank you for your help I think you were right it helped to solve the problem but I still have an issue with the first pdf data it is repeating in each file

you can check the order information folder and you will see.

I appreciate it if it is possible to have a look and share your feedback.

Regards,

@Hossam_Gouda ,

The correction again would be to use only the Extract Structured Data and Write Range Activities in the Then part of If and remove the whole If, as there is no looping of the pages to be done, even that part is not necessary.

Also, Could you add the below Expression in the Assign Activity before the Close Application.

ExtractedDT = new Datatable

This will erase the data in the datatable after it is already written to the Excel sheet, so that when used again, it will only contain the new data from next PDF document table.

2 Likes

Thank you so much I forgot to clear the data table. I appreciate your support so much.

1 Like

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