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

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

How to parse an incoming file into multiple files

(0) ShareShare
ReportReport
Posted on by

Hi,

 

  I am building out a Scheduled flow and have an input file as follows:

Te1-xxx~A
Te1-xxx~B
Te2-xxx~C
Te3-xxx~D
Te3-xxx~E
Te3-xxx~F
Te3-xxx~G

 

  I need to split it out into 3 files (since there are 3 teams) and want it to be output as follows using the 1st characters before the 1st dash as the filename.

 

Te1.csv:
Te1-xxx~A
Te1-xxx~B

 

Te2.csv:
Te2-xxx~C

 

Te3.csv:
Te3-xxx~D
Te3-xxx~E
Te3-xxx~F
Te3-xxx~G

 

Thank you

I have the same question (0)
  • Matthy79 Profile Picture
    4,178 Super User 2024 Season 1 on at
    Re: How to parse an incoming file into multiple files

    This is how it could be done:

     

    Matthy79_0-1705155769526.png

     

    Here a sample code of it. You can import it in a new manually triggered flow using the classic designer and the clipboard feature.

     

    {"id":"fd73dee0-d08d-4e1d-96de-b357c5db9179","brandColor":"#8C3900","connectionReferences":{"shared_onedriveforbusiness":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_onedriveforbusiness/connections/9ea7e6383d7d44aba11b5e23bfd7a957"}},"shared_office365":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_office365/connections/1597557c9920416e9a930edfee990646"}},"shared_sharepointonline":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/shared-sharepointonl-b959cb53-5ecb-4b41-805f-06e7795a0bd2"}},"shared_teams":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_teams/connections/da0f4068677c48aba01f0613c77dcb5b"}},"shared_conversionservice":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_conversionservice/connections/shared-conversionser-c02d19aa-75cf-44e4-b0f1-c36e677a6a16"}},"shared_commondataserviceforapps":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_commondataserviceforapps/connections/62947705b1a746319ca1e59aae985afc"}}},"connectorDisplayName":"Control","icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=","isTrigger":false,"operationName":"Scope_parse_file","operationDefinition":{"type":"Scope","actions":{"Compose_file_content":{"type":"Compose","inputs":"Te1-xxx~A\nTe1-xxx~B\nTe2-xxx~C\nTe3-xxx~D\nTe3-xxx~E\nTe3-xxx~F\nTe3-xxx~G","runAfter":{}},"Compose_lines":{"type":"Compose","inputs":"@split(outputs('Compose_file_content'), decodeUriComponent('%0A'))","runAfter":{"Compose_file_content":["Succeeded"]},"description":"split(outputs('Compose_file_content'), decodeUriComponent('%0A'))"},"Select_Team":{"type":"Select","inputs":{"from":"@outputs('Compose_lines')","select":"@first(split(item(), '-'))"},"runAfter":{"Compose_lines":["Succeeded"]},"description":"first(split(item(), '-'))"},"Apply_to_each_team":{"type":"Foreach","foreach":"@union(body('Select_Team'),body('Select_Team'))","actions":{"Filter_team":{"type":"Query","inputs":{"from":"@outputs('Compose_lines')","where":"@startsWith(item(), items('Apply_to_each_team'))"},"runAfter":{}},"Compose_to_show_what_to_save":{"type":"Compose","inputs":"Create file \"@{items('Apply_to_each_team')}.csv\" with content\n\n@{join(body('Filter_team'), decodeUriComponent('%0A'))}","runAfter":{"Filter_team":["Succeeded"]}}},"runAfter":{"Select_Team":["Succeeded"]},"description":"union(body('Select_Team'),body('Select_Team'))"}},"runAfter":{}}}

     

  • AP-03101741-0 Profile Picture
    on at
    Re: How to parse an incoming file into multiple files

    Thanks I will try it out.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 560 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 347 Moderator

#3
Expiscornovus Profile Picture

Expiscornovus 262 Most Valuable Professional

Last 30 days Overall leaderboard