Sorting Pdf Files from Gmail Trigger

I have attach a gmail trigger in my n8n , so i want that only pdf file should be processed or passed pdf or word , is there any way to achieve this?

Hey @Burhan_Nathdwara !

Try this way, the IF node will keep only items where at least one attachment has a PDF mime type.

Set the condition in first field with that expression and compare as boolean.

i want that only pdf or docx file should be passed , if the email consist others files as well but only pdf or docx should be passed

Hey @Burhan_Nathdwara !

Use this expression if you want items :

{{ Object.values($binary).some(a => a.fileName.endsWith(‘.pdf’) || a.fileName.endsWith(‘.docx’)) }}

PDF or DOCX files.

using this all the files passed is there any possibility that only pdf or docx file pass?

Object.values(binary).some(y => y.fileName.endsWith(“.pdf”)) || Object.values(binary).some(y => y.fileName.endsWith(“.ics”))

Try that instead, and try to type it, and not just copy/paste since “ double qoets can behave strange.

cheers!

P.S JUST SEEN THAT YOU ARE USING EXPRESSIONS BUT AS FIXED TEXT.

Click in top-right corner of the input to “expression” not “Fixed”.