I am creating a workflow where an email is sent when a new Google Calendar event is created.
If there is text in the description field of the Google Calendar event, I want to include it in the email body.
However, the text from the Google Calendar description field is output in HTML format, making the email body very difficult to read.
Could you please let me know if there is a way to retrieve the information from the Google Calendar description field as plain text?
Hey Hatori, when Google Calendar sends the event description, it often includes the content in HTML format (especially if it came from a form or a formatted invite). That’s why the email body ends up looking a little messy.
You can try using a code node to strip the HTML
This will clean it up. Add this in the Code node before your email node:
const html = $json["description"] || "";
const plainText = html.replace(/<[^>]+>/g, '').replace(/ /g, ' ').replace(/&/g, '&');
return [{ plainText }];
Then in your email node, use {{$json["plainText"]}} in the body instead of the original description.
Hope this helps! Cheeeers
Thank you for the response!!
Thanks to your advice, I was able to convert it to plain text!!
However, it seems that the line breaks have been removed when converting to plain text.
Is it possible to retain the line breaks while still converting to plain text?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.