cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Splitting Text with "New Line" Delimiter

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

1 ACCEPTED SOLUTION

Accepted Solutions

Ah, apologies, I forgot to mention the most important part!

In your Populate text field on web page, untick "Populate text using physical keystrokes"

Pavel_NaNoi_0-1695633825493.png

 

View solution in original post

21 REPLIES 21
Agnius
Most Valuable Professional
Most Valuable Professional

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.

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

@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

 

You could try this:

 

copy (from excel)

focus text field on webpage

paste

 

good luck

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,
Agnius
Most Valuable Professional
Most Valuable Professional

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.

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

@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

@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

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!

----
If my post has answered your question, please thumbs up and mark this post as a solution.

I also offer paid consulting services at www.peakdigitran.com/appointments and you can find me on LinkedIn at https://www.linkedin.com/in/michael-annis-80903/,
Agnius
Most Valuable Professional
Most Valuable Professional

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?

 

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

@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
Most Valuable Professional
Most Valuable Professional

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.

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

@Agnius,

 

There is no problem with the columns headers. The first column is accessed with %CurrentItem[0]% and the second column is accessed with %CurrentItem[1]%. Please refer to the following images.

 

Screenshot 2023-09-20 at 12.13.57 PM.pngScreenshot 2023-09-20 at 12.16.12 PM.pngScreenshot 2023-09-20 at 12.23.22 PM.png

The values are pulled from the appropriate cells. The issue is that the text in the Excel cell has new lines (circled in image 1 of 2), and the text that Power Automate maps ignores new lines (circled in image 2 of 2).

 

Screenshot 2023-09-20 at 12.57.05 PM.png

 

Screenshot 2023-09-20 at 12.54.41 PM.png

Agnius
Most Valuable Professional
Most Valuable Professional

Okay. Why are you using the clipboard there? You don't need to set the clipboard text and then get it. You already have the value in a variable.

Also, I don't see any Replace text actions there. As suggested, if you want to use Send keys (which is recommended, because Populate text field in web page does in fact ignore newlines), you should use Replace text to replace \r?\n (using regex) with {Enter} so that the Enter key is sent by Send keys to create a new line.

-------------------------------------------------------------------------
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.

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

@Agnius,

 

The Replace text action produces the same result as the Split text action. The text is still mapped into one line and new lines are ignored. Here is an image of the actions I am using. Is there something I am missing?

 

Screenshot 2023-09-21 at 1.48.04 PM.png

Agnius
Most Valuable Professional
Most Valuable Professional

Try experimenting with different expressions you may need. For instance, try simply using \r (which stands for a carriage return) instead of \r?\n. If Replace text doesn't find the exact pattern, it will simply not replace anything, but will keep the original value in %Replaced%. So, if your value does not actually have newlines (to be replaced by \n) but only has carriage returns, using \r?\n will not replace anything, but \r could.

-------------------------------------------------------------------------
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.

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

I've come across this before, do me a favour, in a vacuum setting, just set up a "Launch a browser instance" (whichever you use) and have it attach to the window in which you want to write your text into, now just use a "Populate text field on webpage" with emulated typing and write this into the box:

 

Some issues were spotted in the ticket:
<BR>
<BR>
Some Note

 

(<BR> is an HTML tag for a Single Line Break, i.e. new line)

See if that creates two new lines for you, if it does, proceed with the following:

Instead of splitting your text, just use a Replace text,

In your Replace text, create it as in the image below, replace  %NewVar% with the variable containing all the text from the cell:

Pavel_NaNoi_0-1695391350612.png

(If it does not work first time try \r as suggested if it is indeed carriage returns)

 

@Agnius,

 

\r?\n successfully detects the new lines, but the problem is with the Replace text: {Enter} part. The actual text '{Enter}' is outputted in the breakpoints rather than the key {Enter}. Is there a way I can send an enter key inside the Replace text action?

 

Screenshot 2023-09-23 at 12.19.27 PM.pngScreenshot 2023-09-23 at 11.27.22 AM.png

@Pavel_NaNoi,

 

The break points are found with \n, but the Replace with: \n<BR> part does not create a new line. Instead it outputs the text "<BR>" between the break points. \r produces the same result as well.

 

Screenshot 2023-09-23 at 1.11.14 PM.pngScreenshot 2023-09-23 at 1.12.41 PM.png

Agnius
Most Valuable Professional
Most Valuable Professional

Try deactivating escape sequences in Replace text. Also, are you still doing this with Send keys?

-------------------------------------------------------------------------

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.

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

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (494)