cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Kav
Level: Powered On

Line Break in Create File Output

Hi everyone,

 

I have a flow which has an action to 'create a file' on a server, as seen here in this screenshot:

https://drive.google.com/file/d/1PoGn3SU-0rvnU1m2KUTJ6KAp7-BuHLdc/view?usp=sharing

 

Problem is the output text is all joined together in a single line, even when I have hit enter to put each field on a separate line, it does not put a line break in the output text file. How can I achieve this?

 

PS; we cant attach files in this forum?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Line Break in Create File Output

Hi @Kav

 

Looking at the screenshot, I will assume you are trying to create a file from responses submitted in a Microsoft Forms. I tried to replicate your scenario, and the steps below worked for me. Perhaps you can follow them and report back the results.

  1. For the trigger, I added a Microsoft Forms - When a new response is submitted. I selected the respective Form Id from the dropdown.
    CreateFile-1.PNG
  2. For the next step, I added a Initialize variable, which I renamed to Initialize responseText Variable. I am using this variable to add all the data needed from the form responses to create a text file.
    CreateFile-2.PNG
  3. Since there might be multiple form responses, Flow will automatically add an Apply to each action once you add a Microsoft Forms - Get response details action and select the Form Id and Response Id.
  4. I followed the Microsoft Forms - Get response details action with an Append to string variable action. In this action, I select the variable name from the dropdown and in the Value field, I entered all the fields I need from the form to create the text file.
    CreateFile-3.PNG
  5. Then outside the Apply to each action, I added a OneDrive - Create file and a Create File Azure Storage actions and the file was created with all the line breaks as formatted in the Append to string variable action. In the screenshot below, you can see I used the value from the variable in the File Content field.
    CreateFile-4.PNG

Please check out the screenshots below and try it out. Please let me know the results of your tests.

CreateFile-5.PNG

 

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

7 REPLIES 7
Super User
Super User

Re: Line Break in Create File Output

Hi @Kav

 

Looking at the screenshot, I will assume you are trying to create a file from responses submitted in a Microsoft Forms. I tried to replicate your scenario, and the steps below worked for me. Perhaps you can follow them and report back the results.

  1. For the trigger, I added a Microsoft Forms - When a new response is submitted. I selected the respective Form Id from the dropdown.
    CreateFile-1.PNG
  2. For the next step, I added a Initialize variable, which I renamed to Initialize responseText Variable. I am using this variable to add all the data needed from the form responses to create a text file.
    CreateFile-2.PNG
  3. Since there might be multiple form responses, Flow will automatically add an Apply to each action once you add a Microsoft Forms - Get response details action and select the Form Id and Response Id.
  4. I followed the Microsoft Forms - Get response details action with an Append to string variable action. In this action, I select the variable name from the dropdown and in the Value field, I entered all the fields I need from the form to create the text file.
    CreateFile-3.PNG
  5. Then outside the Apply to each action, I added a OneDrive - Create file and a Create File Azure Storage actions and the file was created with all the line breaks as formatted in the Append to string variable action. In the screenshot below, you can see I used the value from the variable in the File Content field.
    CreateFile-4.PNG

Please check out the screenshots below and try it out. Please let me know the results of your tests.

CreateFile-5.PNG

 

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


View solution in original post

Kav
Level: Powered On

Re: Line Break in Create File Output

Wow, thanks for the detailed response. I followed your flow steps and the problem still appeared.

 

Then I realised the problem, it was actually notepad that was showing the text incorrect, the data was indeed on new lines when you opened it in wordpad, but for some reason opening in notepad showed everything on a single line. Odd, but sorted now, thanks!

Talha
Level: Powered On

Re: Line Break in Create File Output

Hi@faustocapellanj  @Kav,

 

Thanks for your post its saves my time.

 

Is there any way to bring a New Line in NotePad(.txt) file ??

 

Because i am Reading this Notepad with VBA coding, VBA Takes all the file content as a single line.

 

if i Open manually and Press Enter button, then VBA read the Notepad content as seperate line.

 

so is there any possibilites to bring New line in NotePad file.

Thanks

Super User
Super User

Re: Line Break in Create File Output

Hi @Talha 

 

If you want to add the new line to a text file using Flow, you can insert the text below where you want the line break:

"\r\n"

Those are the characters used for line breaks. Please try it and let me know.

Regards,

Fausto Capellan, Jr


Fausto Capellan, Jr


Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Proud to be a Flownaut!


Kav
Level: Powered On

Re: Line Break in Create File Output

Interesting! I might try this solution out.

 

I figured the issue was the new line character that Flow was using is different from what Notepad uses, as the file when opened in anything other than notepad, would appear OK on separate lines.

Kav
Level: Powered On

Re: Line Break in Create File Output

hey @faustocapellanj ,

 

I just tried this solution and unfortunately it did not work, any other ideas?

 

Kav
Level: Powered On

Re: Line Break in Create File Output

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,242)