Skip to main content

I’ve seen a ton of articles and posts on turning a comma-separated list into separate fields, but none on the opposite. I have text values in five different fields that come from columns in Google Sheets. I want to turn them into a comma-separated string to feed to my API. The challenge is that there isn’t always a value for all five fields, one or more can be empty.

So if I simply do Field1Value, Field2Value, Field3Value, Field4Value, Field5Value in the zap, and Field1 and Field 4 are blank, the result is extra commas like:

, Field2Value, Field3Value,, Field4Value.

Any ideas?

 

@jeffernst 

Try this Code (JavaScript):

 

 

RESULTS

 


@Troy Tessalone This worked perfectly, thank you so much, I will be using this in many zaps. You rock.


Hi @jeffernst 

This can be done with a Code step: https://zapier.com/apps/code/help


@Troy Tessalone just saw your sample, let me try with that.


@jeffernst 

See Code above.


@jeffernst 

Here’s another option

 


@jeffernst 

Did you get this to work?


@jeffernst 

Consider using Sub-Zaps to share common Zap actions across other Zaps: https://zapier.com/apps/sub-zap-by-zapier/integrations#triggers-and-actions

 

 


Reply