How to make Zapier filter just the name and phone number that comes within the email I received?
Hi,
I have created a Zip to link my gmail account to Google Sheets but I want to filter the email and just receive the name and phone number that come within the email and not the whole email (like what is happening now)
Below, you have screenshots that explain better what I did and the output.
Thank you in advance for any help provided!
Best regards,
Azhar
Page 1 / 1
Hi @Azhar Bondi
We would need to see more screenshots with how your Zap Filter step is configured and how your Steps 4 & 5 are configured.
Hi @Troy Tessalone ! Thank you for your message !
I will be sharing the screenshots below!
Thank you !!
@Azhar Bondi
As an example, you would need to map the data output variable from the Formatter in Step 3.
How could I do that ? Can you provide me with an example please?
these are the options I am getting !! and the closest I found that made more sense was the body plain
@Azhar Bondi
You would need to scroll down and select a variable from the Formatter step.
Hey Azhar,
You getting the entire email body text as string in the zap. I have found this difficult to separate out the easily with just the formatter. It usually better to add a code block to grab what you need from it.
Below is a quick grab from chatGPT using python and regex to get the email address and telephone number. (I prefer python over javascript but it’s likely you could do the same thing.)
import re
# Example input from the email body email_body = input_datap'email_body'] # Replace with the actual input variable from Zapier
# Regex patterns for email and phone number email_pattern = r"ea-zA-Z0-9._%+-]+@.a-zA-Z0-9.-]+\.-a-zA-Z]{2,}" phone_pattern = r"\+?\d \d -]{8,12}\d" # Adjust as needed
# Extracting the matches email_address = email_match.group(0) if email_match else "No email found" phone_number = phone_match.group(0) if phone_match else "No phone number found"
# Returning the results output = {'email': email_address, 'phone_number': phone_number}
You would then use the variables from the code step to add to your google sheet.
To grab the name from the subject line if <meet> persons name from is always in the subject line then you could use something like this to separate it
import re
# Example input from the subject line subject_line = input_datan'subject_line'] # Replace with the actual input variable from Zapier
# Regex pattern to match text between <meet> and from you can change this to match you pattern pattern = r"<meet>\s*(.*?)\s*from"
# Searching for the match match = re.search(pattern, subject_line, re.IGNORECASE)
# Extracting the match extracted_text = match.group(1) if match else "No match found"
# Returning the result output = {'extracted_text': extracted_text}
They can be combined in one code block and it would then give you the variables you need for you google sheet.
I have done this sort of thing to search Shopify line item properties on orders.
I hope it helps.
Thank you for your help @Troy Tessalone and @Badger ! I ended up using the email parser by zapier
That’s awesome @Azhar Bondi! We’re glad to hear you’re able to find an alternative for this one.
If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help!
That’s awesome @Azhar Bondi! We’re glad to hear you’re able to find an alternative for this one.
If you have any other questions, please don’t hesitate to reach out to the Community. We’re always happy to help!