I’m trying to send emails with attachments using an Excel file and attachments uploaded into Specific Google-Drive Folder
So, here’s the list of the files&folders on the specific folder named: Conv-Test
and here’s the content of the USA folder for example
The EmailList.xlsx file content demo as below:
This list will be longer, with about 20-30 records, the AttachmentsFolder will be the same as the Folder name in Google drive that have the attachments
The Email Subject and Body will be the same for all emails.
So, what I’m trying to achieve is to Send Emails with this scenario and loop till the end of the email list:
Send an email to [email protected] and put any fixed subject and in the body just: Hello Tommy, Please check the attached file/s,
and regarding the attachment, it will go into USA folder since it’s on the Excel file, and upload all the content (1 PDF or Multiple PDFs) as attachments and send it, Then wait 10 Seconds and go the next email and so on !
SO, i’ve started with listing all googledrive files and folder within the specific folder
Hey @MotazHakim, this is a tough one and you would need to implement several different concepts to make this work.
My suggestion would be to do something like this:
Read the Excel file, use the Split in batches node to split up the items into batches of 1
Inside the loop for each individual batch: list and download all relevant files from Google Drive
Build and send the email
Close the loop and process the next batch
Especially the “build and send the email” part will be tricky as you have an unknown number of files, all appearing as their own item. You would need to include custom code to make this work (converting multiple items into a single item with multiple binary properties). So, it might be worth considering alternatives instead of making your life hard. Is creating a shareable link for each folder an option, so you can simply include the link to each folder in your emails?
You can try an approach to the following workflow, but as @MutedJam rightly points out maybe it is easier to share each folder to its recipient.
Because if there is not the same number of files in each of them, it is difficult to attach all files in the same email (plus you can exceed the maximum sending weight for attachments), so in this approach, the user will receive an email for each file in the corresponding folder.
Also, in order not to exceed the sending limits of the Gmail API, I have placed a one second pause between each loop.
Hi @martinhache
Many Many thanks for taking the time building this demo specificly for me
let us analyze it
The switch node you used as it’s only 3-4 records !!, but in real, it will be 20-30 records, and every record with Unique Email and attach So, i don’t think it will work like that
on Route 0 (USA) you List, then Split excel !!!, then Download, then send gmail, for sure since you specific the case for example (USA) we need to manually put the ID of the USA folder to be downloaded, and then you put a split and looped it !!! i think it’s wrong to loop in the excel file, since we are in USA already !!
Regarding Email sending limit, we have a Mail server so, no worries
will open the spreadsheat, split it, Google Drive List based on the Folder ID on the split node
download the folder with the folder ID, send email to email in the split node, use the name and country in the subject and body
This workflow is working perfectly and exactly as i want, and i’ve used this function to merge multiple binaries as attachments