Multiple Value Last Column

I need to create a “CSV” file for a system in which the last column can have multiple values but no header for the extra values, like this:

Key, Values
key1,value11
key2,value21,value22
key3,value31
key4,value41,value42,value43

Is there a way to do this directly in EasyDataTransform?
The best I got is to generate the output with numbered header values for the extra columns and then I manually remove them.

@pablovarela

Your CSV file is arguably not ‘well formed’ (the CSV format is not well defined).

However I did manage to output to the format you wanted with a bit of tweaking. See attached.

pablovarela.transform (2.2 KB)

Thanks for the quick answer!

But … sorry I explained my problem not completely. My values can contain commas, so the CSV delimiter will enter into play when exporting.

For instance, one can have a value like in the following:
Key, Values
key1,value11
key2,“long with, value21”,value22
key3,value31
key4,value41,value42,value43

I know that the problem is that the CSV format is not valid, but I’m trying to find a workaround so I avoid including a manual step at the end.

If you download the .transform file above you will see that I used a pipe (|) delimiter to avoid that issue.

So basically concat everything into one column with values separate by commas and then export as delimited text using a delimiter that you know doesn’t occur within a value. That way I was able to get:

Key, Values
key1,value11
key2,value21,value22
key3,value31
key4,value41,value42,value43

1 Like