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 / Need help removing ext...
Power Automate
Answered

Need help removing extra space after text splitting

(0) ShareShare
ReportReport
Posted on by 7

Very new to power automate (so be kind lol) and trying to just make a simple flow to help with some stuff at work. I want to split the text from a standardized email template, which will eventually be directed into an excel table. I am having an issue where there seems to be extra space added after the text I want parsed (code shows the raw input is " Spar\n\n"). But the input from the email is "Spar" 

 

Please see below for the result and code: 

 

Email Template: 

 

rug: Spar

pic: xxxxxxx xxxxxxxxx

ight: xxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx

rce: KL

 

 
First Line: first(skip(split(first(split(body('Html_to_text'),'pic')),'rug: '),1))
ZachB4_1-1680890692444.png

 

Second Line: first(skip(split(first(split(body('Html_to_text'),'ight')),'pic: '),1))
ZachB4_2-1680890741448.png

 

Third line: first(skip(split(first(split(body('Html_to_text'),'rce')),'ight: '),1))

ZachB4_3-1680890781379.png

 

Fourth Line (which is not having the issue, so no picture): first(skip(split(body('Html_to_text'),'rce: '),1))

 

Looking for any help or suggestions on how to fix this! Thanks! 

Categories:
  • Kaif_Siddique Profile Picture
    2,108 Super User 2024 Season 1 on at

    Use trim() to remove leading and trailing whitespace.

  • ZachB4 Profile Picture
    7 on at

    Okay awesome! Question: where in the code should I apply the trim()? Sorry.. like I said. New to this lol 

  • Verified answer
    Jcook Profile Picture
    7,783 Most Valuable Professional on at

    @ZachB4 

     

    Try:

    First Line:

    trim(first(skip(split(first(split(body('Html_to_text'),'pic')),'rug: '),1)))

     

    Second Line:

    trim(first(skip(split(first(split(body('Html_to_text'),'ight')),'pic: '),1)))

     

    Third Line:

    trim(first(skip(split(first(split(body('Html_to_text'),'rce')),'ight: '),1)))

     

    Fourth Line:

    trim(first(skip(split(body('Html_to_text'),'rce: '),1)))

     

  • ZachB4 Profile Picture
    7 on at

    @Jcook @Kaif_Siddique  Thanks both! This worked! 

  • Ximbalou Profile Picture
    6 on at

    Hello @Jcook ,

    Wish you a excellent 2024.

    Not sure if you can help me, but I am trying to do something similar to this, but I am struggling.

    I want to extract the 2nd link, but I am getting the 1st one.

    Using this formula from html to text: 

    trim(first(split(last(split(body('Html_to_text'),'Invoice PDF')),']')))



    Ximbalou_0-1704187437988.png

     

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
Mohsin Ali Profile Picture

Mohsin Ali 424

#2
11manish Profile Picture

11manish 328 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard