Workflow to process PDFs as well, just as it does with compressed files

Hello Community, I have a question.

I’m encountering an issue with the workflow. It works correctly when the email contains a compressed file, but when the email includes a PDF, I receive an error. I assume this happens because the system expects a file to decompress and, when it doesn’t find one, it generates an error.

However, I need the workflow to process PDFs as well, just as it does with compressed files. The workflow helps me identify invoices (some are compressed, while others are in PDF format) and transfer them from Gmail to Drive and Google Sheets.

How can I resolve this issue? Thank you in advance for your support!

1 Like

Hello @solomon,

Thank you for your response and the solution provided in the other topic.

I have an IF node before the compress node. Can I use this existing IF node, or do I need to create a new one? I’m unsure how to set up the conditions to read both the PDF files and the compressed files.

1 Like

You should be able to remove the “Do Nothing” node and connect the other false if statement path to the Upload PDF to Drive. You may need to make slight changes in the upload node to reference one or the other correctly tho. Not sure.

Could you ctl a, ctl c the workflow and click the ‘</>’ button on the forums and paste the workflow into that field?

There may be a few things to adjust.

Create an IF node here

To get the file type.
You can also use the SWITCH node instead, if you want to filter by more than 2 file types.

1 Like

Hello @solomon,

I get an error in the PDF to Drive Node.

Switch Node:

Work Flow:

Upload PDF to Drive

Are you using the correct binary field name?
attachment_0

1 Like

Hi @solomon, I hope you are doing well. I made some changes, but it is not passing the PDF to the next node as it should. There is no output, and there is no error message.

You have to use $binary to get the MIME type

1 Like

Hello @solomon, thank you, now I get this in the next node “The item has no binary field ‘file_1’ [item 0]”

You’re missing the name again, @daniel30

remember: The binary field name is always in that orange/red color above the file.

2 Likes

Hey @solomon! I took your suggestion and made a few additional adjustments. Guess what? It’s working now! Thanks for your help!

1 Like

I’m glad it’s working @daniel30 :muscle: