– Easy Guide to Extracting Fields from Emails – Easy Guide to Extracting Fields from Emails

Discover how to easily extract fields from emails using Streamline your workflow and save time with our simple step-by-step guide.

The Problem: Extracting Fields

I had what seemed like a simple task: receive an email from our website’s contact form, parse it, and extract fields like name, email, and message. I thought it would be easy, but I couldn’t have been more wrong. The reality was far from simple; it felt like trying to find a needle in a haystack. My inbox was overflowing, each email packed with valuable information that I needed to sort and organize efficiently.

The challenge of parsing fields from these emails, especially considering their standardized structure, turned into a significant hurdle. It was a task that, at first glance, seemed straightforward but quickly proved to be anything but. This issue began to threaten my workflow and efficiency, bogging me down in complexity.

I decided to automatise it with However, through trial, error, and a fair bit of persistence, I finally cracked the code. I discovered a way to make this daunting task manageable using Let me share the steps I took to transform this overwhelming challenge into a smooth and streamlined process.

Example of email I was going to parse

Example of email I wanted to parse

All I need was to get Name, Email & Message

The Solution: Step-by-Step Process Using

Step 1: Start with a Custom Mailhook on

Custom Mailhook

Each mailhook will get it's unique email address.

Here’s how we kick things off: with a nifty trick called a custom mailhook on Picture it as laying down a net. You set up this mailhook and it gives you an unique email address. All you’ve got to do then is send or forward your emails to this new address. Just like that, you’ve caught them in your net, and you’re all set to automate the rest. It’s super simple and the perfect way to start sorting those emails with no problem!

Step 2: Utilize a Text Parser with REGEX text parser with custom regex

Text Parser

The magic starts here, with the regex pattern.

Ok, next step, we play with the Text parser. This tool with a little bit help of REGEX help to extract to find exactly what we need. The REGEX code itself was pretty complex (link to explanation): 


However, it’s not the only issue on this step. Thing is, it returns each find into its own bundle, not all together into array or object:

Text parser output

A bit of puzzle. But hey, we are here to solve it!

Step 3: Employ an Array Aggregator

Array Aggregator setup

Array Aggregator

We just need name, email, message. Skip other fields.

Imagine you’ve got a big basket. This step is all about using that basket, but for your data. It’s called an Array Aggregator, and it’s super handy. You know all those bits of info you picked up with the Text Parser? Well, they’re all over the place (in multiple bundles), right? 

The Array Aggregator is like saying, “Hey, let’s get all these pieces together in one big group.” It takes all those separate bundles and mixes them into one array. It’s like making a fruit salad out of scattered fruits – everything ends up in one bowl, nice and organised.

Step 4: Convert to JSON

Thanks to Array Aggregator we have everything in single array, but still in 3 different objects:

Array Aggregator output

So, we’re going to turn everything into JSON, kind of like drawing up a treasure map. By using “Aggregate to JSON,” we map out where all our data pieces lie. Picture JSON as the X marks the spot, showing us the location of our gathered treasures. 

Aggregate to JSON

Aggregate to JSON

We just need name, email, message. Skip other fields.

					{get(get(Array; 1); "name")}}
{get(get(Array; 2); "email")}}
{get(get(Array; 3); "message")}}

Now, you might think, “Can’t we skip this and just grab what we need later?” Sure, you could use the `get` function in future steps to save a couple of moves. But, by organising everything into a single JSON object now, we avoid repeating the same steps over and over. It’s all about being smart and efficient, getting our treasure in one go!

Step 5: Parse JSON to Extract Fields

Parse JSON to easy use in next steps

Parse JSON

We have to define what data structure to use

Now comes the chill part: parsing the JSON. This is like translating our treasure map into plain English, making it super easy to use later on. Parsing JSON is like having a magic key that unlocks all the goodies we packed into our JSON object. 

It makes sure we can quickly grab whatever piece of info we need without any hassle. Think of it as prepping all your snacks before a big movie night; everything’s ready to grab when you want it. Easy one!

Step 6: Update Google Sheets

And here we are at the grand finale: updating Google Sheets. This is where we stash all the treasures we’ve dug up so we can see them all laid out nice and easy. Just like tucking away your finds in a treasure chest, we’re putting all our data gems into Google Sheets.

Google Sheet Step

Google Sheets - Add a Row

Just select what goes where.

It’s our way of making sure every piece of info is easy to spot and ready to use. Think of it as displaying your movie collection in perfect order – now everything’s ready for you to dive in whenever you need.


And there you have it! That huge, daunting task? Totally manageable with Now, you’ve got the skills to pull info from emails and sort it all out on autopilot. It’s like unlocking a secret skill that zips through the chaos, saving you loads of time and keeping everything tidy. 

Imagine having a magic wand that just whisks the mess away – that’s what you’ve got now. So, take a deep breath and dive in; you’re ready to tackle it all without even breaking a sweat!

Table of Contents

Picture of Lucas Ostrowski

Lucas Ostrowski

From software management to founding a top digital agency in automation & no-code. Sharing insights on productivity, AI & business automation.