"How Can I Create a Gmail Workflow Where Docx Files Can Be Opened Without Renaming the File?"

This topic was automatically generated from Slack. You can find the original thread here.

Hello! I’m having an issue with a Gmail workflow where those receiving emails sent from this workflow can’t open docx files. pdf works fine, but docx can only be opened if you rename the file and add docx to the extension, or you open it in word. The issue with this is that the user only knows it’s a docx file when it doesn’t open normally, so not a great user experience if they have to rename it or try to open it one way then another. I’ve been thinking I could use the filename as the attachment object key (currently I’m just using a string), but the key is text only. Which is a little weird because the help text for that field suggests the key must be the filename and it must have the extension. But if it’s text only obviously that won’t work because the file name and type are dynamic.

Hi , I think you can use Pipedream’s expressions to have the filename dynamic (Read more here). For example, you can construct the object in the attachments prop as:

{{ {[`${steps.trigger.file_name}.${steps.trigger.file_extension}`]: steps.trigger.file_url} }}

You might need Node.js knowledge, if you don’t have it I would suggest you to search for free resources online.

Or if you’d like to hire an expert to support your usecase, feel free to use this link: Connect with a Pipedream Partner

Can you try putting the values in the respective boxes?

Thanks! Haven’t tried this yet but I wouldn’t have guessed at the double curly brace wraps. Also didn’t realize you could do template literals in there. I’m a web dev so I see what you’re going for here. Thanks for the direction.

this just adds the filename as a string. this field doesn’t seem to recognize expressions.

ok! Can you please pass me a link to a random docx file so I can test it here?

There’s definitely a bug related to attachments in the Gmail Send Email action.
I used this docx example document because it is a direct link to the file.
From my test, though, it seems that even .pdf files are not being parsed correctly as attachments…
I created an issue, you can get notified for changes by subscribing to it.
Thank you for reporting this bug!

thanks. i suppose a work around at this point then would be to use another email provider.

Yes, if that is possible

thanks for your help!

i’ve subbed to the issue.

also what do you make of the help text below that field? it seems that a developer at some point believed that it was necessary to have the file extension and filename in the field as the object key

What do you think of this description?

Add any attachments you’d like to include as objects. Each key should be the filename and it must contain the file extension (i.e. .jpeg, .txt). The value should be the download url link for the file.

that’s fine for the custom expression but doesn’t make sense for the “construct an object” tab since the key field is text only. in order to use the filename and extension as the key there it would have to be an expression, as that’s dynamic.

Pipedream workflows support dynamic custom expressions using curly brackets, {{}} , as Leo mentioned above. For example, it is possible to use {{steps.trigger.event.filename}}.docx and it will substitute the part inside the curly brackets

but the key field for the “construct an object” tab does not evaluate expressions.

it converts everything to strings

Oh I get it now

Hmm that might be a bug

Let me confirm with the team