Hello, I’m very new to n8n and I’m trying to upload PDF files to Google Drive. With Mistral OCR I extract certain data from the PDF, then I check in Google Drive if a folder with that name already exists. If yes, the file should be placed there; if not, a new folder should be created and the file uploaded.
My problem is that the workflow creates the folder twice: once with file 1, and then again with file 1 and 2. Does anyone know what I’m doing wrong?
Hey @Flo786 hope all is good. Welcome to the community.
When you create a folder or a file which may already exist, you need to first check if it does, as Google Drive allows creating folder and files with the same name right next to each other. You can use the google drive node with Search for Files and Folders operation to check this.
My workflow now looks like this. Unfortunately, the AI data and the actual document don’t match. The document name and stored folder don’t match the data in the document.
Previously, my workflow worked fine except for the storage step. As described above, the storage did not work as intended. After some research and adjustments, my workflow now looks as follows.
At first, I thought everything was working, but it turns out the workflow is mixing up the data extracted via OCR and AI from the documents. As a result, the documents are not being named according to their actual content and are therefore also being stored in the wrong location.
The current plan for the workflow is to send the uploaded files to OCR step by step (to avoid overloading it), and afterwards correctly name and store the files.
What could be causing this problem? Could it be related to how I’ve set up the loops? And if so, what would be a better way to structure the loops so that each document is processed, named, and stored correctly?
Thank you very much in advance — it would be really great if someone could help me with this.
When you execute your workflow you can later trace each step by going from node to node and see its input and output. You can see the values produced by each node and decide whether it is an expected value or not.
When you say
what do you mean? Which node produces wrong results?
I think the issue is caused either by the Upload node or the Merge node. I need to combine the project number and the document number with the correct base document before uploading it. Otherwise n8n says, that the file has no binary data.
However, in the Upload node I’m not able to select the necessary variables to rename the document based on the extracted data.