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 / Split String into mult...
Power Automate
Answered

Split String into multiple substrings

(0) ShareShare
ReportReport
Posted on by 6

Hey,

i am currently building a flow, which puts a csv table into a xlsx file. A part of that is splitting a single line of content into multiple

substrings to match them with the columns of the excel table. The difficult part is to find the correct expression for the compose action to split the string.

The data lines look like this: text,text2,text3,1,2,3,01.01.2001 or text,text2,2,4,6,02.02.2002 and I want to split it into 5 parts. Starting at the back it needs to be split at every ",". The challenge is here that I don't know how to stop after the 4th "," so that I get only 5 Parts.

I tried different expressions like: 

reverse(take(reverse(split(item(), ',')), 5))

But this cut everything behind the 5th ",".

The result should look like this: ["text,text2,text", "1", "2", "3", "01.01.2001] or ["text,text2", "2", "4", "6", "02.02.2002"]

 

Thanks for every help 🙂

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,857 Most Valuable Professional on at

    Hi @MirCola,

     

    You can also use a skip to get those other items. With a join and an array function you can turn it into one item. With a union you can put all the items back into one array.

     

    Try something like the below

    union(array(join(skip(reverse(split(trim(item()), ',')), 4), ',')), reverse(take(reverse(split(trim(item()), ',')), 4)))

     

  • MirCola Profile Picture
    6 on at

    Hi @Expiscornovus ,

     

    I tried your expression and it works great, but there is one thing I don't know why it happens.

    If the data is like this: text,text2,text3,1,2,3,01.01.2001 the result is perfect.

    But if the data is like this: text,text2,text3,1,1,3,01.01.2001 the 2nd "1" is not in the result array. When they are different it works like a charm.

     

    Thank you for your help 🙂

     

  • Verified answer
    Expiscornovus Profile Picture
    33,857 Most Valuable Professional on at

    Hi @MirCola,

     

    Apologies, that is because I was using a union. That function will only use a value once in the array. 

     

    In that case let's use a concat and some additional split and join functions.

     

    Try this instead:

    split(concat(join(array(join(skip(reverse(split(trim(item()), ',')), 4), ',')), ';'), ';', join(reverse(take(reverse(split(trim(item()), ',')), 4)), ';')), ';')

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 641

#2
Vish WR Profile Picture

Vish WR 640

#3
Haque Profile Picture

Haque 495

Last 30 days Overall leaderboard