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 / Splitting Text with "N...
Power Automate
Answered

Splitting Text with "New Line" Delimiter

(0) ShareShare
ReportReport
Posted on by 158

Hello,

 

I am trying to map the text in an Excel cell to a textbox in a webpage, but Power Automate writes all the text consecutively and ignores new lines. To solve this, I tried to split the text by using the "new line" delimiter but the issue still remains. The "Populate text field in webpage" action is a non-option because it deletes the entry of the previous index when making the entry for the current index.

 

Also, the "send keys" action does not write the first letter of the first word.

 

How can I map the text exactly as shown in the Excel cell?

 

Screenshot 2023-09-14 at 8.34.14 PM.png

 

Screenshot 2023-09-14 at 9.42.12 PM.png

 

Screenshot 2023-09-14 at 9.26.56 PM.png

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Populate text field in web page has an option to not overwrite existing values under Advanced: 

    Agnius_0-1694757394044.png

     

    But it won't work with newlines anyway. Your best bet would be using Send keys but replacing new lines with {Enter} so that the Enter key gets sent. Otherwise a new line will usually be ignored.

    To solve the problem of losing the first character of the first word, I would suggest using Focus text field on web page before using Send keys. And maybe adding a little wait. It just seems like when you only use Send keys, the first key gets sent too soon and the field on the web page may not be ready to accept it.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • OnurOnal Profile Picture
    158 on at

    @Agnius,

     

    I have a "send keys" action that presses {Enter}, but the real problem is with the split action not splitting the text properly into the "Descriptions" list. I can press enter, but it has no use if I cannot split the text in the Excel cell into separate line-entries.

     

    As for the first letter being missing, I am using Focus text field on web page and adding a 1 second wait but the same thing happens.

     

    I think that the best way to map would be use the Populate text field in web page with the append option, and then Focus text field on web page and Send keys {Enter} afterwards (shown in image below). But again, this would only work if the text in the Excel cell is split properly. Are there any alternative ways I can split the text without having to use the "New line" delimiter?

     

    Screenshot 2023-09-15 at 2.33.08 PM.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You could try this:

     

    copy (from excel)

    focus text field on webpage

    paste

     

    good luck

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    You don't really need to split it. You can simply use Replace text to replace \r?\n (with regular expressions enabled, thi will replace new lines) with {Enter} and then pass all of this into a single Send keys action. It will create a single string with {Enter} instead of new lines. Send keys will interpret the {Enter} as a key to send and will do new lines for you.

     

    Not sure why splitting by new line doesn't work for you, though. Do you want a different delimiter? Split text does support several standard delimiters, and you can also provide custom delimiters, if needed. But you do need some sort of a delimiter to split it.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • OnurOnal Profile Picture
    158 on at

    @MichaelAnnis,

     

    I have copied the text in the cell using the copy action, but it appears that the only pasting action pastes to another Excel worksheet. Is there a way I can store the copied value into a variable which I can then paste using the send keys action? 

     

    Screenshot 2023-09-17 at 4.10.19 PM.png

  • OnurOnal Profile Picture
    158 on at

    @Agnius,

     

    Splitting with new line delimiter does not work because of something having to do with Excel. If it were a txt file there would be no problem, but for some reason Power Automate is not able to detect new lines within Excel cells.

     

    I tried using the Replace text action as you mentioned but it does not work either.

     

    Screenshot 2023-09-17 at 5.51.59 PM.png

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Yes. If it’s in a variable, you can Set Clipboard and use the variable to set the clipboard. 

    if excel and the page are not communicating, copy out of excel, try opening notepad, pasting into notepad, and then select all copy, and paste into the page. 

    good luck!

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Have you enabled regular expressions in the Replace text action?

    Agnius_0-1695017822669.png

     

    Also, what exactly is in your %CurrentItem% and why are you using %CurrentItem[1]% and %CurrentItem[2]% in some of those screenshots?

     

  • OnurOnal Profile Picture
    158 on at

    @Agnius,

     

    Yes I have enabled regular expressions. %CurrentItem% stores the current row in the Excel worksheet, so %CurrentItem[1]% and %CurrentItem[2]% are simply column values of that specific row. The text I want to split is in the second column of the Excel worksheet, hence the reason I am using %CurrentItem[1]%.

     

    Screenshot 2023-09-19 at 12.34.05 AM.pngScreenshot 2023-09-19 at 12.35.14 AM.png

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    It's not really a value. It's stored as the column name instead. If you are reading each row one by one, make sure that your Read from Excel worksheet action does not store the first row of the range as column headers.

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 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard