N8N Gmail
Gmail is used in a ton of N8N workflows and in this article we are going to cover some of the most popular usecases.
Items like extracting information from emails, auto forwarding emails, uploading pdfs to google drive, and much more. If you prefer to watch a YouTube video over reading an article, it is linked down below.
If you need help with any N8N workflows or data for your business I’m taking on customers
If you are brand new to N8N you can sign up here
Gmail to Google Sheets
For our first example we are going to take an email, parse the information and then pass it into Google Sheets.
The goal is to send website leads into 3 different sheets on a Google Spreadsheet based around it’s email subject (which I have defined). We will then extract the contents of the email.

Gmail Trigger
Let’s use the Gmail Trigger to bring in specific emails. Be careful with how often you are polling. I will poll once a day. Since these are coming from a form on my website, I’m going to filter for only the form email address.

Switch
Based on the email subject we are going to send the email to a specific Google Sheets tab in a master spreadsheet.

Code
The code below will clean up the inputs from the emails.
import re
# Access the first input item
item = items[0]["json"]
# Get the snippet
text = item.get("snippet", "")
# Regex to extract the fields
pattern = r"name:\s*(.*?)\s+email:\s*(.*?)\s+budget:\s*(.*?)\s+message:\s*(.*)"
match = re.search(pattern, text, re.IGNORECASE)
if match:
name, email, budget, message = match.groups()
# Normalize budget format: "0$" → "$0", "15 $" → "$15", etc.
budget = budget.strip()
if re.match(r"^\d+\s*\$?$", budget): # e.g., "0$", "15 $", "10"
budget = f"${re.sub(r'\D', '', budget)}"
elif re.match(r"^\$?\s*\d+", budget): # e.g., "$10", "$ 20"
budget = f"${re.sub(r'\D', '', budget)}"
return {
"name": name.strip(),
"email": email.strip(),
"budget": budget,
"message": message.strip()
}
else:
return {
"error": "Could not parse fields",
"raw_snippet": text
}
Sheets
Each new entry will be a row in the sheets. I’m not to worried about duplicates so I will append each row. Like the workflow above, we will have to do this 3 times. Once for Mentorships, and then once for sponsorships and freelancing.

Gmail Ai Agent
Now let’s look at an example where we can use an AI Agent to help us clean up our results instead of the Python Code from above. We will be using the GPT 4o model. Below is the prompt we can use.
Based on the snippet below, can you output the name, email, budget, and message?
{{ $json.text }}
please put this in Json Output and fix any issues with budget. We want budget in USD. Example $100 or $1,000 Only show the JSON output.

This is the Structured Output Parser:
{
"Name": "Ryan",
"Email": "ryannolandata@gmail.com",
"Budget": "$100",
"Message": "I need N8N help"
}
Gmail Forward Email
Another popular workflow is to forward emails if they have certain phrases or context. This workflow shown below is quite simplified, but it’ll forward any email for sponsorships.

To start looking for sponsorship emails, I’ll try to find any email that mentions collab or sponsorships. I do this with the search subject collab or sponsorship

The settings for the Gmail forwarding.

The email automatically being forwarded

Gmail Send to Google Drive
Another super popular workflow is to send email attachments to Google Drive. This can be invoices, or files from an editor or designer.

To download the files, we need to turn off simplify in the Gmail trigger and use these settings:

The PDF file then gets sent to drive like this.

Outro
If you found this helpful, feel free to share it on LinkedIn. Also if you need any help with N8N workflows or data for your business feel free to reach out. I’m taking on customers.
Ryan is a Data Scientist at a fintech company, where he focuses on fraud prevention in underwriting and risk. Before that, he worked as a Data Analyst at a tax software company. He holds a degree in Electrical Engineering from UCF.