cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Text file

Hi,

 

My file is in one drive and I use get file content and store it in a string.Kindly tell me how to loop through each line of the text file.?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @ThreeCool 

 

Once yo have the split array, you can add an apply to each on the array variable. Now you are looking for a very specific value and so you will have to build the logic on top of it on how you can identify that string and the create the actions in the flow accordingly, 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

5 REPLIES 5
Highlighted
Dual Super User III
Dual Super User III

Hi @ThreeCool 

 

To loop through each line of the text file, you will have to break it into lines first. Assuming that you have the content of the file in a variable you can use the split expression on a compose action as: 

split(variables('text'),'.')

 

This will split the entire text into lines separated by '.'

 

You can then use the apply to each to iterate over each item from the split string. 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted

Hi,

 

Thanks for the reply.

 

But My file is a html file .So how can I split it using . ?

and also I don't understand the concept of Applyeach...It doesnt allow the string to be used inside...So how can I use it to loop each line and how to see it while running the bot?

Highlighted

Hi!

 

So what you can do is intialise a variable of type string and another of type array. In the string get the content of the file. In the variable of array, for value, switch to expression editor and use the split expression. For html, you can split on enter and for that you can initialize another string variable and hit an enter to store the enter key (refer to this post here: https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/10-MS-Flow-hacks-troubleshoots-wor...)

 

You can then use the apply to each to iterate on the array. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Highlighted

Wow thanks a lot .This is very much helpful

 

The main thing is I want to know How to iterate each element of an array ? Say I got this as an output from the logic you said now

 

[
" </div>",
" <div class=\"a-row\">",
"<div class=\"a-section aok-relative s-image-square-aspect\">",
" ",
" ",
" alt=\"Sportscar-Buy\"",

 

 

Here I need that alt line alone ...I want to extract Sportscar-Buy from that array and like that there are many alt in the program so how to loop to get all alt? 

Highlighted

Hi @ThreeCool 

 

Once yo have the split array, you can add an apply to each on the array variable. Now you are looking for a very specific value and so you will have to build the logic on top of it on how you can identify that string and the create the actions in the flow accordingly, 

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Kudoed Authors
Users online (7,439)