I'm experimenting with using a Form to create a new announcement on our Google Sites page. The form asks for the title and body of the post. The form is also linked to a spreadsheet. In the form a can be input and will display in the spreadsheet. The console log in the script also shows the paragraph break.
The Sites API seems to strip out the and replace it with a space. For example, what was supposed to be 2 paragraphs, each with one sentence, becomes two sentences in the announcement. How do I get the paragraph break to display in the new announcement created in this script? Any help would be much appreciated. Thank you in advance.
var posted = "POSTED";
for (var i = 0; i < data.length -1; ++i) {
var timeStamp = data[i][0];
var name = data[i][1];
var title = data[i][2];
var body = data[i][3];
var status = data[i][4];
Logger.log(title);
Logger.log(body);
Logger.log(status);
if (status != posted) {
var url = 'myintranetsite.com'
var page = SitesApp.getPageByUrl(url)
// Got this code from another post, script won't fail in event of duplicate titles
var announcements = page.getAnnouncements({
includeDrafts: false,
includeDeleted: false,
search: title });
if (announcements.length > 0) {
title += ' (' + announcements.length + ')';
var newPost = page.createAnnouncement(title, body);