Best answer

Can I build a rule or step in my Zap that checks file size before sending the email with attachments?

  • 1 June 2023
  • 8 replies
  • 160 views

Userlevel 1

Hi all! I’m hoping someone can help. 

 

I have a zap process that takes a direct download link from a google sheet and sends an email with the file attachment. I have been successful so far. If the file is larger than 25 mb, it doesn’t send through gmail. I have no way of knowing what doesn’t send because zapier doesn’t tell me. 

 

Is there anyway for me to build in a rule (if under 25 mb - do this, if over 25 mb do something else), or a step in my process that checks file size before trying to send the email? Or some alert when it’s not successful? 

 

Thank you! 

icon

Best answer by Troy Tessalone 1 June 2023, 20:43

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.

8 replies

Userlevel 7
Badge +14

Hi @aprilfisher01 

Good question.

It’s recommend to send large files by including the link in the body of the email, thus no need for attachments.

Userlevel 1

Thanks @Troy Tessalone  - I’m working with a team internationally who cannot access where the files are stored due to their country’s restrictions so this doesn’t work for me. 

 

While I agree with your suggestion, sending them the direct download link is not ideal. Depending on their VPN status, they might not be able to access the file. Ideally I can attach the files as my zap is set up, but I am alerted when the attachments are too large to send so I can make other arrangements.  

Userlevel 7
Badge +14

@aprilfisher01 

Can you post screenshots with how your Zap steps are configured to give us more context about the order of the steps?

Userlevel 7
Badge +14

@aprilfisher01 

If you use the Zap action: GDrive - Find File, then it returns a data point for the File Size (in bytes)

 

EXAMPLE

1024 bytes is 1.024 KB which is 0.001024 MB

 

 

Userlevel 1

 

@Troy Tessalone absolutely!!! does this screenshot help?

If the files are too large I need an alert or otherwise some other way to know the attachments didn’t send. 

Userlevel 7
Badge +14

@aprilfisher01 

How is data being added to the GSheet? (automatically form another Zap, or manually)

If automatically, then you should try to add the file size from Dropbox to the GSheet as new columns to use.

 

If you have a Professional or higher Zapier plan, then you can add Paths.

Otherwise, you’ll have to configure separate Zaps that are chained together via Webhooks. (advanced)

 

Dropbox also returns the file size in bytes to reference.


 

 

Try these Zap steps...

  1. Trigger: GSheets - New Row
  2. Action: Dropbox - Find File
    1. For File 1
  3. Action: Dropbox - Find File
    1. For File 2
  4. Action: Formatter > Numbers > Spreadsheet Style Formula
    1. This would be use to SUM the Bytes from the 2 files, then divide using the formula below.
      1. Or a Code step can be used
  5. Action: Paths
    1. Path A
      1. Action: Filter
        1. Formatter step 4 value >= 25
      2. Action: Gmail - Send Email
        1. Used to ALERT
    2. Path B
      1. Action: Filter
        1. Formatter step 4 value < 25
      2. Action: Delay
      3. Action: Formatter
        1. For File 1
      4. Action: Formatter
        1. For File 2
      5. Action: Gmail - Send Email

 

 

The formula to convert bytes to megabytes is:

Megabytes = Bytes / 1,048,576

For example, if you have 5,000,000 bytes, the calculation would be:

Megabytes = 5,000,000 / 1,048,576 = 4.76837 MB (rounded to 5 decimal places)

Therefore, 5,000,000 bytes is approximately equal to 4.76837 MB.

 

Userlevel 1

@Troy Tessalone thank you for the suggestion. At this time, the links to the dropbox files are manually added to the google sheet. This is by design as there are steps taking outside of dropbox to determine when they are “ready” to send.

 

I thought maybe I could use a google sheet trigger → and set the action to find the in dropbox to determine the file size, but the files are nested in folders that are then nested inside a parent folder and I don’t think the “find file” step can search in folders set up this way. 

 

Is there a path or action that can work on my “text in formatter” step that can take the file and read the size? I’m stuck here.

 

 

Userlevel 7
Badge +14

@aprilfisher01 

You’d have to find the File in Dropbox or upload the file again to a certain Dropbox folder to get the folder metadata that includes the file size.