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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Text split in Power Au...
Power Automate
Answered

Text split in Power Automate Desktop

(1) ShareShare
ReportReport
Posted on by 15
Hi to all.
 
New PAD user here.
 
Can anyone help me with or point me to a solution for the following problem I have in PAD.
 
How does one split text up to a maximum character limit of say 40 characters, stopping at the nearest space BEFORE the limit, to avoid splitting a word.
 
I've been searching online for some time now and can see that this is solved in the cloud version of Power Automate (https://community.powerplatform.com/forums/thread/details/?threadid=5d8baa57-bb87-4da0-b908-e8e42da65676), but for the life of me I cannot fathom or find a way to do it in PAD, assuming it can actually be achieved in PAD.
 
Currently, I am splitting the test as a textlist using space as delimiter. Which essentially gives me a list of all the words in a column. From here I cannot see a way to count the characters up to the nearest space before the limit and split the list and continuing on until the text ends. 
 
Looking forward to suggestions and help!
 
Categories:
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    15,404 Super User 2025 Season 2 on at
    Hi,
     
    This seems to work, if I got the requirements right.
     
    Text to split:  The Power Platform Community Forums are awesome and getting help here for Power Automate Desktop is super!
     
    Results:
     
     
     
     
    SET FullText TO $'''The Power Platform Community Forums are awesome and getting help here for Power Automate Desktop is super!'''
    Text.SplitText.Split Text: FullText StandardDelimiter: Text.StandardDelimiter.Space DelimiterTimes: 1 Result=> WordsList
    SET MaxLength TO 40
    SET CurrentChunk TO $'''\"\"'''
    SET FinalChunk TO $'''\"\"'''
    LOOP FOREACH CurrentWord IN WordsList
        IF (CurrentChunk.Length + CurrentWord.Length + 1) <= MaxLength THEN
            SET CurrentChunk TO $'''%CurrentChunk% %CurrentWord%'''
        ELSE
            SET FinalChunk TO $'''%FinalChunk% %CurrentChunk%
    '''
            SET CurrentChunk TO CurrentWord
        END
    END
    SET FinalChunk TO $'''%FinalChunk% %CurrentChunk%'''
    Text.CropText.CropTextAfterFlag Text: FinalChunk FromFlag: $'''\"\" \"\"''' IgnoreCase: False CroppedText=> Results
    
     

    ------------------------------------------------

     

     

    ⭐ If this was helpful, please like and mark as a verified answer to help others find this too!

     

     

    Always glad to help! 💯💯💯💯💯

     

    Tom

     

    Follow me on LinkedIn - Thomas Rice, PMP | LinkedIn

  • Lee H Profile Picture
    15 on at
     
    Hi Tom, that is response is more than I hoped for! 
     
    It's taught me a lot about how you can use this software just in terms of how it behaves and how you can express variables etc. so I'm very appreciative. In replicating this myself, the only part I cannot replicate exactly is the expression in the IF statement.
     
     
     
    I'm fairly sure this is why its not working for me as the flow skips the else statement entirely for the full loop and my text is most definitely longer than 40 characters! 
     
    Full flow:
     
     
    Thanks again for your help. 
  • Lee H Profile Picture
    15 on at
    After some research, I figured out what I had not done. 
     
    Marked as solved.
     
    Again, thank you for your help.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard