Question

How to preserve line breaks

  • 6 February 2023
  • 6 replies
  • 964 views

I have a Zap running that takes a web form submission (from WPForms), creates a new row in a Google Sheet and then uses those cells to create both a Google Doc and a draft email in Gmail.

One of the form fields is a long text box that allows line breaks. I have confirmed that the data sent to Google Sheets contains the line breaks, and these are preserved when the Zap sends the data to Google Docs. However, the line breaks are deleted when creating the draft email in Gmail.

I have the format type set to “html” but can’t figure out why Zapier is deleting line breaks here. Any thoughts?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @imagineertobe 

Good question.

If you are using HTML for the Gmail email format, then the line breaks need to use the <br> tag.

https://www.w3schools.com/tags/tag_br.asp

Hm. The line breaks exist in the Google Sheets cell and are being respected by Zapier when it sends the data to Google Docs, but not when it sends the info to Gmail. So this seems like a Zapier parsing issue, but are you suggesting that I need to figure out how to add <br> tags during the Sheets to Gmail import?

Userlevel 7
Badge +14

@imagineertobe 

If you are using HTML as the email format, then line breaks are indicated with the <br> tag.

Perhaps try using TEXT as the email format.

I can’t use TEXT as the email format because I need to style the text (with <b> tags, for instance). 

Here’s the formatting I’m using.

Hi there,<br><br>
I have received the following request. Could you please let me know if you are available? <b>No need to reply if you are not available.</b><br><br>
<b>EVENT:</b> Important Client - [Event Name from Google Sheets]<br>
<b>SCHEDULE:</b><br>
<ul><li>[Event Dates and Times from Google Sheets]</li></ul>
<b>LOCATION:</b> [Event Location from Google Sheets]<br>
<b>TEAM:</b> Yes, TBD<br>
<b>DESCRIPTION:</b> [Event Description from Google Sheets]

It’s the [Event Description from Google Sheets] that’s not preserving the line breaks that appear in Google Sheets.

Userlevel 7
Badge +14

@imagineertobe 

Yes, the [Event Description from Google Sheets] will need to have the line breaks converted to the <br> tag.

Try using Formatter > Text > Replace.

Userlevel 6
Badge +8

I just wanted to jump in to say that I can confirm that Troy is spot on here. You’ll need to convert “\n” to “<br>” (and maybe even “<br><br>” if that doesn’t work).