Best answer

Splitting comma-separated list into individual Google Sheet columns

  • 7 April 2021
  • 3 replies
  • 24 views

My Hubspot form contains several multiple choice questions where more than one answer can be selected (e.g. “What fruit do you like to eat? Select all that apply.”)

 

If multiple answers are indeed selected, these then get transferred to Zapier as a comma-separated list (e.g. “bananas, apples, oranges”). I’d like to split these line item answers back into the individual answer categories (e.g. “bananas”, “apples”, and “oranges”) so that I can use them individually later to auto-fill a Google Sheet. This Google Sheet has each of those answer categories as individual columns (e.g. “bananas” = A, “apples” = B).

 

I’ve tried multiple Formatter actions and can’t get them to do exactly this. Is it possible on Zapier? 

icon

Best answer by Troy Tessalone 7 April 2021, 20:10

Hi @cohosales 

You may need to explore the use of a Code (https://zapier.com/apps/code/help) step to parse and assign the answer options to designated variables that are then mapped to specific columns in the Zap.

For example, if answer set contains “apples” then assign to variable ‘A’, which is then mapped to a specific column in the GSheet.

This is a more advanced approach in terms of a solution however as it requires knowledge of coding in JavaScript or Python.

View original

3 replies

Userlevel 7
Badge +10

Hey @cohosales!

This is definitely a tricky one, since you could have a number of combinations in terms of the options that the person selects in the form.

As Troy mentioned, there is likely a way to use code to accomplish this. You could create a post in the Code and Webhooks forum and link back to this post, to see if anyone can help out. You could also check out our Zapier Experts to see if you could hire someone to do it for you :)

Userlevel 7
Badge +10

Hi @cohosales 

You may need to explore the use of a Code (https://zapier.com/apps/code/help) step to parse and assign the answer options to designated variables that are then mapped to specific columns in the Zap.

For example, if answer set contains “apples” then assign to variable ‘A’, which is then mapped to a specific column in the GSheet.

This is a more advanced approach in terms of a solution however as it requires knowledge of coding in JavaScript or Python.

Badge +2

@cohosales The function you’re describing would be the split function under the text formatter. This would allow you to split based on a comma and output one variable at a time or output all the variables either as individual variables or as a 3-part line item. This could be a step in the right direction, but it might not be actionable for your needs.

Another option is the Paths feature. This would allow you to create 3 different paths with different criteria such as “text contains ‘apples’”, “text contains ‘oranges’”, “text contains ‘bananas’”. These are not mutually exclusive so all three could potentially run. You would then add a GSheets step to each path where the appropriate field was filled out for each path. Unfortunately, only 3 paths are available at this time, but you can nest paths allowing for more options. It’s not the cleanest solution, but might work for you! 

Reply