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 / Parse data from text file
Power Automate
Answered

Parse data from text file

(0) ShareShare
ReportReport
Posted on by

I need to be able to parse data elements from a test file, this is a jumble. 

I should always have a starting ref and end ref to the data (Words, headings etc) I thought that index, may be best?

 

Any Ideas? Below is ample with required text in bold, and static in italic.

 

TxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxt

 

A1. abcd123456     (Data length can be variable, but always has a space at end).

 

TxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxt

 

A3. A name of a a person  (Data has spaces etc in and variable length)

 

TxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxtTxt

 

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    Hi!

    So can you split its content by using 'new line delimiter', and A1, A3 will always be at the beginnig of a row, and its contents inside that same row?

    if so, and assuming your text file content is stored in a variable called 'myInputString', you can try with the following

    split(variables('myInputString'),'
    ')

    Now you can use Filter Array to remove all lines that do not start with A1, A3, etc.

    Hope this helps

     

  • ChristianAbata Profile Picture
    8,951 Most Valuable Professional on at

    hi @Anonymous  what I'll do is define a # max character for my lines for example

     

    A1. abcd123456 has 10 and 

    A3. A name of a a person has 20

     

    So my max cloud be 25 and then unse indexof to locate my lines and substring with my max # of characters to get my line, of course , this could work if my line is separated from all text I mean in a separated line.

  • v-litu-msft Profile Picture
    on at

    Hi @Anonymous,

     

    If each data is a line, you could use the split() function to separate these lines, then find these lines whether contains the "A1.", "A3.", if it contains, drag them out by using split() function again.

    The method that separate lines, you could initialize a variable, this variable is empty but has an "Enter" (when you create it, just click enter once).

    Annotation 2020-04-22 161500.png

     The way to drag the string after "A1." is that using split function, then get the second member of the array:

    Annotation 2020-04-22 161534.png

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    This was eventual solution.

     

    TitleStart = add(indexof(string(body('Convert_Word_DOCX_Document_to_Text_(txt)')?['TextResult']),'Project title:'),14)

    TitleEnd = add(indexof(substring(string(body('Convert_Word_DOCX_Document_to_Text_(txt)')?['TextResult']),add(variables('TitleStart'),10),1500),'Requested Quotation:'),10)


    TitleText = replace(trim(replace(substring(string(body('Convert_Word_DOCX_Document_to_Text_(txt)')?['TextResult']),variables('TitleStart'),variables('TitleEnd')),'\r\n','')),' ','')

     

     

    Converted the doc/docx to text document then simply parsed it thus for the information. All three of above obviously placed into variables. This method allows me to change the start / end txt to comply with many different input doc layouts.

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