Extracting and Concatenating Attachment Names from Gmail - join function

I am trying to get a string with all the attachment names from Gmail as input

I am encountering an issue while trying to extract and concatenate the names of all email attachments from Gmail into a single string within my scenario. My objective is to create a comma-separated list of attachment names from emails processed through the Gmail module.

I’ve tried the following:

  • Using join Function with .fileName: I attempted to concatenate the attachment names using the join function: {{join(1.attachments[].fileName; ",")}}. However, this approach only yielded an empty string.
{{join(1.attachments[].fileName; ",")}}
  • Using join Function without .fileName: When I tried {{join(1.attachments[]; ",")}} , the output consisted of a series of {object} placeholders (e.g., {object}, {object},... ). The count of {object} matched the number of attachments, but I could not retrieve their names.
{{join(1.attachments[]; ",")}}

Welcome to the Make community!

you need to map the file names using the built-in function map first

before you can join them.

For more information, see

Links

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

2 Likes

Thank you, got it working:

{{join(map(1.attachments; "fileName"); ", ")}}
2 Likes

Hello @piotrirving welcome to the community :wave:

Awesome to hear that you managed to get this up and running by using the map() function as recommended by @samliew :clap:

Thanks a lot for stepping back here and sharing the final version of the function with the rest of us. This could be super helpful to many others :pray:

1 Like