cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ThreeCool
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

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
yashag2255
Dual Super User II
Dual Super User II

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!

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?

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!

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? 

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (3,036)