web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Expression to extract ...
Power Automate
Answered

Expression to extract items from a Subject line of an email and then input them into an email table

(0) ShareShare
ReportReport
Posted on by 19

Power Automate Community,

Good afternoon, I have had success extracting data from a body of an email and importing it into excel.  My question today is there a way to do this also from a Subject line of an email? Here is my ask I need the # between these two brackets [ ] subject line that will be extracted and go into into a field in excel called incident # then I need to take the rest of the subject line after the "]" bracket and input it into excel in the 'Subject" field . A sample of my Subject line looks like this:   

[210528] Final - SEV1 Transport Southwest Arkansas  note my subject is always formatted the same 

 

I tried to write this expression but it keeps getting an error -

To populate my Incident # field -  first(skip(split(first(split(subject('Html_to_text'),'Incident #')),']'),1))

To populate my Subject field - first(skip(split(first(split(subject('Html_to_text'),'Subject')),']'),2))

As you can see I'm very new to writing expressions

 

Any assistance would be appreciated.  Thanks in advance.  I have learned so much from this message board I'm truly appreciate all of your assistance. 

 

Owen

Categories:
  • Verified answer
    Ellis Karim Profile Picture
    12,379 Super User 2026 Season 2 on at

    Hi @ohostetler ,

     

    You can try this expression to see if it works for you:

     

    slice(first(split(variables('subject'),']')),1)
    slice(last(split(variables('subject'),']')),1)

    Snag_270dae.png

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • OH-28081859-0 Profile Picture
    19 on at

    Ellis,

     

    Good morning, let me start by saying thank you for taking time out of your day to assist.  Hey your recommendation worked however when a new ticket with a different subject line came in your recommendation just added what I put in the Initialize variable - Value box the old ticket.  My tickets stay in the same format but the information changes.  For example my current ticket is [210379] Final - SEV2 MIDWEST Service Impact same format just different information.  Is there anyway to change the Value  in the Initialize variable box to look at the subject line of the email.  Thanks again.  

     

    Owen 

  • Ellis Karim Profile Picture
    12,379 Super User 2026 Season 2 on at

    Hi @ohostetler ,

     

    Keeping the previous flow unchanged, we could simply set the value of the variable to the email subject:

    Snag_46608a.png


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • Verified answer
    OH-28081859-0 Profile Picture
    19 on at

    Ellis,

     

    Good morning, I got it to work I slightly modified what you sent and it works perfect (code below).  Thank you so much I wouldn't have been able to do this without your assistance. 

    slice(first(split(triggerBody()?['subject'],']')),1)

     

    Thanks again, 

     

    Owen

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 315 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 267

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard