What this scenario does: Retrieves attachments from emails and uploads them to Airtable.
Level Of Difficulty: Intermediate
Implementation Time: Approximately 15 mins
If you’re uploading attachments to Airtable, you’re probably uploading a single attachment to a record resulting in numerous unnecessary records. Let us show you how to retrieve and upload multiple attachments to a single record instead. Let’s begin.
Configuring the scenario
The scenario consists of the following modules:
- Gmail > Watch email
- Gmail > Iterate attachments
- Google Drive > Upload a file
- Array Aggregator
- Airtable > Create a record
Here’s the scenario:
Let’s open the Gmail > Watch emails module to configure it. Select the Folder that you want to watch as well as the Criteria. Then enter the Maximum number of results that will be returned during one execution:
Next is the Gmail > Iterate attachments module that separates the attachments in order for each attachment to be uploaded to Google Drive. Once added, the Source Module will be automatically selected since there is only one preceding module:
Moving on to the Google Drive > Upload a file module and as the name suggests, the attachments retrieved from the emails are uploaded to Google Drive using this module. Select the Destination Drive, Target folder and the Gmail > Iterate attachments as the Source file:
Following the Google Drive module is the Array Aggregator which combines the attachments into an array in order to upload them to Airtable as a single bundle instead of individually.
*It’s important to note here that you will need to add the Airtable > Create a record module first before configuring the Array Aggregator for it to be a selectable option under the Target structure type.*
Under Source Module, select the Gmail > Iterate attachments module. Under Target structure type, select the Airtable > Create a record: Records attachment:
In the File URL field, map the Direct download link element outputted by the Google Drive module and in the File name field, map the File name element outputted by the Gmail > Iterate attachments module. If you would like to capitalize the file name, use the capitalize function found under the Text and Binary functions tab:
Last in the scenario is the Airtable > Create a record module. First select your Base, then map the Subject element (or whichever name you want) outputted by the Gmail > Watch emails module to the Name field and map the Array element to the Attachments field:
All done! Let’s go ahead and execute the scenario.
The scenario executed successfully and an email was retrieved containing 3 attachments that were iterated and uploaded to Google Drive. The attachments were then aggregated and sent to Airtable:
Here’s the record created in Airtable:
Quite easy right? Hope you found this tutorial useful.
Happy Automating! 🙌