Best answer

Convert Gmail email body to PDF invoice?

  • 16 November 2021
  • 4 replies
  • 261 views

Hi community! I am am new to zapier and have now exhaustes my search skills.

I receive plenty of invoices (generic mail address, forwarded to GMail) and would like to dump them all to GDrive. For attached PDFs, my zap works fine. But I can’t figure out a solution to store the ones where the mail body is the invoice.

 

GDoc is discontinued.

GMail won’t connect to apps like Docamatic (which works in testing).

IMAP won’t let me filter for attachments.

 

What trick am I missing here?

icon

Best answer by Troy Tessalone 17 November 2021, 17:53

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +14

Hi @LiPi 

Are you using a free Gmail account or a paid Gmail account?

Using a paid Gmail account will remove the limitations you might be experiencing with the Zaps.

My Gmail Zap has an error about connecting to Google-approved or not-approved apps

 

GDoc has a Zap app integration: https://zapier.com/apps/google-docs/integrations#triggers-and-actions

 

Filter steps can be added to Zaps: https://zapier.com/apps/filter/help

 

The Webhooks app can be used to chain Zaps together and get around the free Gmail issue, but this is an advanced approach: https://zapier.com/apps/webhook/integrations

Thank you for pointing out the paid GMail account, I assumed the restrictions applied to all accounts.

 

I am now fetching the mails via IMAP and filter for specific sender names.

Ideally I would like to filter for existence of an attachment but I am stuck here: I only want to pass on mails without any attachments. If I pick one of those mails for testing, I can not select Attachment as a field for “Only continue if…” because there is none. If I pick a mail with an attachment and “Only continue if…” Attachment does not exist, the test fails and I can not continue. Is there a way around this?

Edit: I was confused by the filter field turning blank if I test a mail without attachment. But it still seems to filter for existence of attachments. Weird...

Userlevel 7
Badge +14

@LiPi 

Testing a Zap step can be skipped.

When testing a Filter step it helps you understand if sample record being used would have passed the configured conditions.

If a field is being used on the left side of a Filter condition, but that field is not present in the sample record being used for testing, then yes it will show as blank in the Zap Editor.

I suggest turning the Zap ON and testing live once you feel the Zap steps are configured correctly.

Then check your Zap Runs for the DATA IN/OUT for each step and possible errors to correct: https://zapier.com/app/history/

Yes, the blank field threw me off. The first instinct is to assume that the filter forgot what field it is filtering for but apparently that’s not the case. Splendid, thank you :grinning:

 

One issue I have in a similar zap to store attached pdfs:

Trigger is new attachment in GMail → works fine.

Filter if Attachment mime type is application/pdf → works fine, only mails with PDF attachments are left.

Save attachment to GDrive → if a mail has a PDF attachment AND any other attachment, all are saved to GDrive. How can I only save the PDF attachments?