Make.com Tutorial: Automate Email Analysis with OpenAI GPT-4o, and Google Sheets
Are you overwhelmed by volumes of incoming emails? Ever wanted a way to automate the extraction of relevant data from your inbox and store it in a Google Sheet? With Make.com (formerly Integromat), OpenAI's GPT-4o, and Google Sheets, you can set up an elegant automation to parse unread emails, filter them, and save valuable information in a spreadsheet. Let’s dive into how you can achieve this.
Prerequisites:
- A Make.com account
- A connected Google account
- An OpenAI Account
- A Google Sheet set up to store the data
Watch Unread Emails in Gmail
First, we’ll set up a trigger to watch for unread emails in a specific Gmail folder.
Add the Gmail Watch Emails Module:
- Navigate to Make.com.
- Click on Create a new scenario.
- Search for the Google Email module and select Watch Emails.
- Configure your account connection.
- Set up the properties as follows:
- Search Type: Simple filter
- Mark Seen: True (marks emails as read to avoid reprocessing)
- Max Results: 10
- Folder: Choose the folder
- Criteria: Unread (to process only unread emails)
Aggregate Unread Emails
Next, we gather all fetched emails into an array to process them iteratively.
Add the Basic Aggregator Module:
- Search for and add the Basic Aggregator module.
- Map the
Subject
andText
fields from the Gmail module. - This will aggregate all emails into a manageable array.
Iterate Over the Array of Emails
We need to process each email individually.
Add the Iterator Module:
- Search for and add the Iterator module.
- Map the array from the Aggregator module.
Send Email Text to OpenAI's GPT-4o for Parsing
We will use an OpenAI GPT-4o assistant to extract specific information from the email text. If you don't know how to make an OpenAI assistant navigate to this link and create a new assistant.
Example Assistant Instructions for GPT-4o:
You will receive the text content of an email. Please parse the content and extract the following information in JSON format:
- num_car_sold: The number of cars sold.
- num_car_bought: The number of cars bought.
- num_car_tradedin: The number of cars tradedin.
- total_expenses_daily: The DAILY expense cost.
If any information is missing, output "N/A" for that field. Format the response as follows:
{
"num_car_sold": The number of cars sold.
"num_car_bought": The number of cars bought.
"num_car_tradedin": The number of cars tradedin.
"total_expenses_daily": The DAILY expense cost.
}
Add the OpenAI GPT-4o Module:
- Search and add the Message an Assistant module.
- Configure your OpenAI connection.
- Input parameters:
- Message: Text from the email
- Assistant: Your configured GPT-4o assistant
Filter Emails that Contain "Stats" in the Subject
We will filter only the emails that contain the keyword "stats" in their subject line.
Add the Filter:
- Set a filter condition where
Subject contains "stats"
.
Parse JSON Response from GPT-4o
We need to parse the JSON response provided by GPT-4o.
Add the JSON Parse Module:
- Search for and add the Parse JSON module.
- Map the JSON string from the OpenAI module.
Add Data to Google Sheets
Finally, add the parsed data to a Google Sheet.
Add the Google Sheets Module:
- Search for and add the Add a Row module.
- Configure your Google Sheets connection and select the appropriate spreadsheet and worksheet.
Map the parsed fields ("num_car_sold", "num_car_bought", "num_car_tradedin", "total_expenses_daily") to the respective columns in your Google Sheet.
Voilà! Automated Email Parsing and Data Logging
By following these steps, you now have a powerful automated workflow that watches for specific unread emails, extracts relevant data using OpenAI's GPT-4o, and logs the information in a Google Sheet. This setup will save you time and ensure you never miss important statistical data from your emails.
Final Thoughts
Automation can greatly simplify your data collection processes and improve productivity. With the integrated power of Make.com, OpenAI, and Google Sheets, you can tailor many more workflows to your specific needs. Any questions or inquiries email or my Upwork.
Feel free to share your thoughts or experiences in the comments. Happy automating!