Formatting comma separated data into sentence format for email

Hi all,

This is a fairly complicated format I am trying to kick out of a CSV file and hope that someone has a potential solution. (I’m not sure if anything like this is even possible on the platform).

We have topics that are listed and we need them formatted based on the following rules. I need to kick out the format for a weekly email that is custom to each person, so I need the format to make sense as if it were in a sentence.

Input:
Topic 1, Topic 2, Topic 3, Topic 4 (and so on)

Desired output:

  1. If only two topics:
    Topic 1 and Topic 2

  2. If three topics:
    Topic 1, Topic 2, and Topic 3

If more than three topics
Topic 1, Topic 2, Topic 3, and others

Any help would be greatly appreciated!

I tested this and it works.

Assuming all of the items are in a single cell separated by a comma,

First “extract text from column” and label the column “First Part” configure it to “find all text before” “last instance of matching text” and use , (comma) as the matching text.

Then add another “extract text from column” and label the column “Second Part”, configure it to “find all text after” “last instance of matching text” and use , (comma) as the matching text.

Next add the Insert static text column label it “and Second Part” and in the text field enter:

and {Second Part}

then add another insert static text column and make the new column “whole message”. In the text field enter

{First Part},{and Second Part}

2 Likes

You can also add some < br >'s in there to make a new html line break should you have multiple paragraphs. I do this in emails to our vendors with the order for the week.

1 Like

Hi Thomas,

Thank you so much for your help with this!

The only issue I am having now is when the line has only one topic, i am only showing “,and” instead of a single topic name. Please see below:

Screen Shot 2020-08-10 at 11.55.18 AM

Any thoughts on how to fix that?

maybe it needs one more step, if/else

new column “fixed whole message”

if “whole message” is “, and” then equals column “EX_next… etc” else equals “Whole Message”

1 Like

That worked, thank you so much! This helped me out so much!

2 Likes