I'm very new to Power Automate and Power Apps. I've built this flow in AI Builder to essentially extract 3 key pieces of data from multiple 6 page PDFs (there are 4000+ PDFs, and the layout on all of them is exactly the same) and then populate this information into a Google Sheet. (I use an =IMPORTRANGE to pull this information into another master spreadsheet).
The flow runs correctly, but then at a random point, it errors out, and comes up with the second attached error. I can't seem to find a solution anywhere for this and would really love some help understanding this and how to fix this.
Am I just overloading it with too many PDF's to extract information from, or is there is a limitation somewhere in my flow?
Thanks in advance!
Solved! Go to Solution.
Thanks @Pritzstik for the info!
I believe what is happening is that the Apply to each block is outside the Do until block. Apply to each needs to be inside Do until.
Thanks for the question and welcome to the Power Platform!
Looking at the error, it seems like the folder from where you are processing the PDFs also contains a Google Spreadsheet. The flow fails when it tries to download the spreadsheet which is not possible.
What you can do is add a condition that checks that the file to process is of type PDF, and that way it will not process other file types. This is how you can do it:
I hope this helps!
Thanks so much! I rebuilt the flow according to your screenshot and it didn't fail, and I got a "Your flow ran successfully'!
However I have a second problem. I have 4,206 PDFs in the designated folder, but it's only populated information for 100 PDF's. Any ideas?
Great to hear that you got the flow to successfully run!
Unfortunately the List files in folder in Google Drive only returns a maximum of 100 files. But there is a workaround we can do that might work for you. 🙂 The process is to:
1. We iterate 100 files from folder A.
2. For every file we process we copy it to another folder B, and delete the file from the original folder A.
3. We repeat this process for 100 more files of folder A until there are no more files left once all have been processed and moved to folder B.
4. The flow stops running once there are no more files in folder A.
This is how you can build the flow to achieve it (you can click on the screenshot to see it bigger):
Let us know if something is unclear.
I modified the flow, but I think there's an issue with this. It seems to be working, but only for the first 100 files, so in effect, it's just going through the first 100 files multiple times, creating duplicate lines on the Google Sheet. The flow indicates it's copying the file into Folder B and then deleting it from Folder B. Should the flow not be deleting it from Folder A once it's copied over to Folder B?
Hi - thanks for the update!
Correct, on the Delete file action, make sure select the Id returned by the List files in folder (folder A) and not the Id returned by Create file action (folder B).
Okay I got this to work. I was selecting the wrong Id tag.
Final question? Do I have to run this flow every 100 files? The flow stopped (successfully) after the next 200 files. That's somewhat manual if I have 4000 files, I'd have to run the flow 40+ times.
Hi @Pritzstik - ask as many questions as needed. 🙂
The flow should run until it processes all 4,000 files. Can you check that the conditions are correctly set? Feel free to share a screenshot of your flow.
Hello again - one additional change is needed that I just realized.
On the Do until action, you will need to increase the Count option to a number equal or greater to the number of files you plan to process.
Learn how to create your own user groups today!
Check out the new Power Platform Community Connections gallery!
Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.