Skip to main content
Best answer

Upload gmail attachments to Google Drive folder - file extension gets duplicated

  • December 20, 2024
  • 6 replies
  • 52 views

So the zap seams pretty simple

I’m using new Attachment in gmail trigger and I want to upload the attachments to Google Drive.

each attachment could be a different file type so I’m leaving the “File Extension” parameter blank. (screenshot attached)

 

I’m expecting the filename to be “2024.12.06 - scan.jpg” and I’m getting ““2024.12.06 - scan.jpg.jpg”

Otherwise everything else is working fine.

 

I have created similar zaps before using the older versions of the Google Drive app and this has never happened before.

 

Any ideas?

 

Best answer by Troy TessaloneBest answer by Troy Tessalone

Hi ​@Marika Shmotolocha 
 

Instead of using a Code step which counts as 1 Task, you can use a Formatter step that counts as 0 Tasks.

Zap action: Formatter > Text > Extract Pattern

^(.*?)(?:\.[^.]+)?$

 

Issue with the File name having double file extensions is because the file name include the extension already. (e.g. .jpg)

So even when you leave the File Extension field, GDrive is determining the file extension and including it as part of the file name you see.

Thus it becomes [file.jpg] + “.jpg” = file.jpg.jpg

 

View original
Did this topic help you find an answer to your question?

6 replies

Badger
Forum|alt.badge.img+5
  • New
  • 134 replies
  • December 20, 2024

@Marika Shmotolocha 

Check your configuration it’s likely that the zap is adding the extension and you need to change a setting.

Most likely there will be a setting in the File Extension at the bottom. I believe if this is blank your files won’t get renamed. 

If it is blank reconnect your google drive in case it is misaligned.

 

 


it is blank (see attached screenshot.  That’s why I don’t understand why it’s adding it again.


Badger
Forum|alt.badge.img+5
  • New
  • 134 replies
  • December 20, 2024

 

This was wrong. See my next reply


Badger
Forum|alt.badge.img+5
  • New
  • 134 replies
  • December 20, 2024

@Marika Shmotolocha 

I have just looked at it and any value I use from the gmail attachment ends up with a double extension. My idea about dates is invalid. 

What I found was I needed to strip the extension from the filename and then it would upload correctly.

I used a python code block to remove the last 4 characters and the upload worked

 

 

I hope that helps.

 


Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 31667 replies
  • Answer
  • December 20, 2024

Hi ​@Marika Shmotolocha 
 

Instead of using a Code step which counts as 1 Task, you can use a Formatter step that counts as 0 Tasks.

Zap action: Formatter > Text > Extract Pattern

^(.*?)(?:\.[^.]+)?$

 

Issue with the File name having double file extensions is because the file name include the extension already. (e.g. .jpg)

So even when you leave the File Extension field, GDrive is determining the file extension and including it as part of the file name you see.

Thus it becomes [file.jpg] + “.jpg” = file.jpg.jpg

 


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • 7967 replies
  • December 23, 2024

Thanks for marking the best answer here ​@Marika Shmotolocha! 🙏 I’m so pleased Troy’s suggestion was able to help get things solved. Big shoutouts to both ​@Troy Tessalone and ​@Badger for helping out here—love to see it! 🧡


Reply