Skip to main content

Hello!

I am looking to import a csv file that arrives as an attachment in a mail in my Gmail inbox, into a Google Sheets file. I am using the following:

  • New Attachment in Email: I have a clearly defined label and have a from:x@y.com String setup to specifically identify the email with the attachment. It says “We found an attachment!” when I test it.
  • Utilities in Formater by Zapier: this is where it gets tricky. I use:
    • Formatter by Zapier
    • Utilities
    • Transform - Import CSV File
    • Attachment (Exists but it is now shown)
    • Force first row as Header Row: Yes
    • Type of CSV File: Detect automatically
    • Encoding of CSV File: UTF-8
  • When I test the action, I get the following errors:
    • Formatting data failed: The app returned "The CSV file couldn't be read, usually due to an encoding issue. Error message: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte".
      • I tried all the format available, the only one that doesn’t come up with an error is Latin-1.
    • Formatting data failed: The app returned "The CSV file couldn't be parsed, usually due to a formatting issue. Consider Type of CSV File > Text File as an alternative. Error message: Could not determine delimiter".
      • None of the options work and this is where I get stuck.

What could be the problem? I am attaching a sample CSV file, directly downloaded from the attachment.

This post has been edited by a moderator to remove personal information. Please remember that this is a public forum and to remove any sensitive information prior to posting.

And the attachment file.


Hey there @Studocu, when I see this issue, it is usually because more than one attachment exists on the email that is being sent.  When this happens, we will zip up the file and send a single compressed file with every attachment inside of it.

Usually this is due to the email being sent containing some footer or other element that is embedded into the email but actually also attached to the email as a file as well.

You may wish to try the “New Attachment” trigger instead to see if my theory holds any water.  You may need to use a filter step as well so we only try to continue if the file is a csv.  The Zap could look like this:

Gmail New Attachment trigger => Filter by Zapier (continue if file type contains csv) => Formatter => GSheets et al.

Barring the csv attachment itself actually being a different format, or broken, I think this may work for you!  Let me know what you think or if you had any questions!


Hi @RALaBarge ! Thank you for your answer.

I was already using New Attachment and I only have one attachment in the email anyway. There might an issue with the contents of the email, because it also has a table with the same info as the csv (I pull this email with the attachment automatically from Metabase).

The info in the csv (and in the email) are like this:

Created Date

Created Week

E ID

Q

Rating

Additional info

URL

2022-11-07

45

125543

12345

1

absdg

1

2022-11-07

45

125544

5325

 

 

2

2022-11-07

45

125545

325

 

 

3

 

I tried following your steps but on Filter I get the following when I try to select the fields to “only continue if...”. 

 

 

 

Also, if I select the first one - Attachment (Exists but not shown), then I get this for the last option:

 

Not sure what to do with these and I can’t adjust the email contents, since it’s automated.


Hey @Studocu!  

I know you mentioned you are using the “New Attachment” trigger, but looking at your screenshot I see that there are 2 files listed here: 

We see more than 1 attachment in this example.

Perhaps this screenshot was taken of a different Zap than the “New Attachment” trigger, but since there is more than one object there and if this is the Zap you are testing the CSV import with, I think this is not actually the trigger you think it may be and we are sending a compressed file with your image and attachment.

As far as the Filter step, the inputs would be:

“1. Attachments Mime Type” “Contains” “CSV”

The “CSV” would be typed in directly with no double quotes -- you would not map another field into the 3rd dropdown as shown in your screenshot.  Let me know if you had any more Qs! =)