Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 41kOU2AhBIJS5H1CDIPsaR
Power Automate - Power Automate Desktop
Answered

Writing a message in Web Whatsapp does not keep blank lines

Like (0) ShareShare
ReportReport
Posted on 13 Mar 2024 11:39:06 by 495

Hi,

 

I made a flow using this example:

 

https://youtu.be/MMIvU3OxyWE?si=bJRGYs9vJAfCsb5D

 

And It works fine, but in my case, the message to send has several lines, with blank lines as separator and when the process types the message in Whatsapp does not keep the space, it replaces the new line for an blank space.

 

This is the message in the Excel file, as you can see there are ALT+Enter between lines to separate them.

ExcelCell.png

 

This is the message writing in Web Whatsapp:

 

Message.png

 

As you see, the blank lines were ignored.

I can add {Enter} in the content of the column to force an enter command and it will split the message in several parts, but I want to send the complete content in only one piece, keeping the blank lines.

 

Is there a solution for this scenario? Can I add something in the Excel cell to fix that?

Thanks for any help!

  • Verified answer
    EmilioRoqueta69 Profile Picture
    495 on 14 Mar 2024 at 08:35:31
    Re: Writing a message in Web Whatsapp does not keep blank lines

    I solved adding {Shift}{Enter} in the text message.

    This is the way to add a new line in Web Whatsapp.

     

    Thank you

  • Deenuji_Loganathan_ Profile Picture
    6,105 Super User 2025 Season 1 on 13 Mar 2024 at 13:05:31
    Re: Writing a message in Web Whatsapp does not keep blank lines

    @EmilioRoqueta69 
    I don't have an immediate solution for your reported issues, but I've come up with a workaround that addresses your problems. However, this workaround might affect performance as it's not optimized. Therefore, I recommend thoroughly testing the performance it before implementing it in any real-time projects.

     

    Followed Steps:

    1. Launch Excel and Open File Under Existing Process:

      • Open Excel and load the specified Excel file under an existing process.
      • Path: C:\\Users\\deenu\\OneDrive\\Documents\\Booking Details.xlsx
    2. Read Data from Excel:

      • Read all cells from the opened Excel file and mentioned the first row as a header.
      • Store the range of values in a variable named ExcelData.
    3. Launch Edge Browser and Attach to Specified URL:

    [In my scenario, I have accessed my web-based WhatsApp, completed the validation process, and it's in a ready-to-use state. then I have attached this instance with my browser]

    4. Loop Through Each Row in ExcelData:

    • For each row in ExcelData, do the following steps:
      1. Set Message and Phone Number:

        • Set the message to the value in the first column (index 0) of the current row.
        • Set the phone number to the value in the second column (index 1) of the current row.
      2. Construct WhatsApp URL:

      3. Navigate to WhatsApp Web Page:

        • Navigate to the constructed URL using the Edge browser instance.
        • Set a timeout of 60 seconds for the page to load.
      4. Wait for Page Content to Load:

        • Wait until the specified element (Whatsapp send button) Deenuji_3-1710335675464.pngappears on the WhatsApp web page.
      5. Press the Send Button:

        • Click on the send button on the WhatsApp web page.
        • Set a timeout of 60 seconds for the page to load.

    5. End of Loop.

    Excel:

    Deenuji_2-1710335207736.png

     

    Flow Details:

    Deenuji_0-1710334830528.png

    Output:

    Deenuji_1-1710335003773.png

     

    Code:

     

     

     

    Excel.LaunchExcel.LaunchAndOpenUnderExistingProcess Path: $'''C:\\Users\\deenu\\OneDrive\\Documents\\Booking Details.xlsx''' Visible: True ReadOnly: False Instance=> ExcelInstance
    Excel.ReadFromExcel.ReadAllCells Instance: ExcelInstance ReadAsText: False FirstLineIsHeader: True RangeValue=> ExcelData
    WebAutomation.LaunchEdge.AttachToEdgeByUrl TabUrl: $'''https://web.whatsapp.com/''' AttachTimeout: 5 BrowserInstance=> Browser
    LOOP FOREACH CurrentItem IN ExcelData
     SET Message TO CurrentItem[1]
     SET PhoneNumber TO CurrentItem[0]
     SET URL TO $'''https://web.whatsapp.com/send/?phone=%PhoneNumber%&text=%Message%'''
     WebAutomation.GoToWebPage.GoToWebPage BrowserInstance: Browser Url: URL WaitForPageToLoadTimeout: 60
     WAIT (WebAutomation.WaitForWebPageContent.WebPageToContainElement BrowserInstance: Browser Control: appmask['Web Page \'https://web.whatsapp.com/\'']['Span \'send\' 3'])
     WebAutomation.PressButton.PressButton BrowserInstance: Browser Control: appmask['Web Page \'https://web.whatsapp.com/\'']['Span \'send\' 2'] WaitForPageToLoadTimeout: 60
    END

     

     

    Thanks,
    Deenuji Loganathan
    🤖Automation Evangelist
    Deenuji - Follow me on LinkedIn

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🌟

     
     

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,083 Most Valuable Professional

Leaderboard
Loading started