This Google Apps Script is designed to send emails to several recipients with PDF attachments using data from a Google Sheet which contains the email address of the receiver, email text, name of the receiver, and email subject.
This script automates the process of sending emails with PDF attachments based on data in a Google Sheet. It's particularly useful for sending personalized emails with individualized PDFs attached.
Before using this script, make sure you have the following:
- A Google Sheet with the necessary data.
- The PDF file you want to attach stored in Google Drive.
- Open your Google Sheet.
- Open the script editor by clicking on
Extensions
->Apps Script
. - Paste the provided script into the script editor.
- Replace
Sheet1
with the name of your sheet. - Replace
YOU_PDF_ID_UPLOADED_ON_GOOGLE_DRIVE
with the ID of your PDF file. You can find PDF id by its URL when you want to share it, it is between /d/ and /view e.g. https://drive.google.com/file/d/YOUR_PDF_ID/view?usp=sharing - Save the script.
- Ensure your Google Sheet has the required data columns: Name, Email, Body, and Subject.
- Run the script by clicking on the play button in the script editor.
- The script will send personalized emails to the recipients with PDF attachments.
Note: Add a small delay using Utilities.sleep(1000);
to avoid rate limits.
Contributions are welcome! If you find any issues or have improvements to suggest, feel free to open an issue or create a pull request.
This project is licensed under the MIT License.