This is a Google Apps Script that retrieves today's emails and saves them in spreadsheets for each email address/group provided. It creates two spreadsheets, one with all the emails sent to the email address/group and another with only the emails received on the current day. It also sends an email with PDF attachments of both spreadsheets to the user who executed the script.
- Create a new Google Apps Script project by going to script.google.com , clicking on "New project" and giving it a name.
- Copy the code from EmailTracker.gs repository and paste it into the Script editor.
- Do the necessary customizations.
- Save the script and authorize it to access your Gmail and Drive services.
- In the
getMails
function, add the email addresses/groups that you want to check.- Run the script by clicking on the "Run" button or by setting a time-driven trigger to run it automatically.
- Check your email inbox for the PDF attachments with the spreadsheets.
This code can be easily customized to meet your specific needs. Here are some things you may want to modify:
- Email Addresses: Update the emailAddresses array in the
getMails()
function to specify the email addresses or groups you want to receive emails for.- Folder ID: Add the folder ID of the Google Drive folder which you created to store the attachments.
- Date Format: Update the date variable in the
getMails()
function to specify the date format you want to use in the email subject line and spreadsheet.- Spreadsheet Formatting: Modify the formatting of the spreadsheets created by the code to meet your needs. You can update the main and sub headings, adjust column widths, and change cell styles.
- Email Content: Modify the email subject and body in the
GmailApp.sendEmail()
function to meet your needs.
Google script Page
Google sheets files created
Today mails spreadsheet
All mails spreadsheet
Email with Today mails pdf
Pdf of Todays mails
If you find any issues or have suggestions for improvement, please open an issue or create a pull request.