Shopify Flow + Google Sheets: Ignoring commas in data

Solved

Shopify Flow + Google Sheets: Ignoring commas in data

boona
Tourist
8 0 4

I add a row to a Google Sheet every time we get a review. The review data is raw input from customers and often includes commas. The Flow integration treats all commas as a delimiter though. Is there any way to have Shopify Flow ignore commas in data variables? Thank you!

 

boona_0-1722867237145.png

 

Accepted Solution (1)

ryan_i
Shopify Staff
22 5 8

This is an accepted solution.

Hi there, 

You can use liquid to escape any user data that may contain a comma. For example {{reviewTitle | replace: ',', '\,' }},{{reviewBody | replace: ',', '\,' }}. The escaped comma will not be treated as a delimiter.

Hope this helps!

- Finding Flow useful? Leave us a review.
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 8 (8)

Kalen_Jordan
Shopify Partner
704 29 118

Perhaps a run code step that replaces commas in the review contents with another character or url encodes them.

boona
Tourist
8 0 4

Thanks for the suggestion! I thought about something like that but it would make the review content harder to parse and generally I wanted to avoid modifying user-inputted data. The fix I really need is the ability to use a different delimiter or a way to wrap the review data in some type of character that Shopify Flow would then ignore commas within... Have you ever seen something like that?

Kalen_Jordan
Shopify Partner
704 29 118

Haven't done too much with the google sheets action in flow to date. Pretty sure I could figure something out here. I can dive into it further on a paid basis if that's of interest.

ryan_i
Shopify Staff
22 5 8

This is an accepted solution.

Hi there, 

You can use liquid to escape any user data that may contain a comma. For example {{reviewTitle | replace: ',', '\,' }},{{reviewBody | replace: ',', '\,' }}. The escaped comma will not be treated as a delimiter.

Hope this helps!

- Finding Flow useful? Leave us a review.
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
boona
Tourist
8 0 4

Hey Ryan, appreciate the suggestion. I've not used liquid as part of Shopify Flow, so I hope you don't mind a naive follow up. Would this be an action step I create in advance of the Google Sheets integration? The only "liquid" action I see is called "Log output". Here's how I set it up for now and I'll monitor to see if this works:

 

boona_0-1723255674973.png

 

ryan_i
Shopify Staff
22 5 8

Hi there - it's in the "Add row to spreadsheet" action. If you click on that, you'll see the liquid editing textbox as it is in the screenshot from your original post.

- Finding Flow useful? Leave us a review.
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
boona
Tourist
8 0 4

Oh wow, didn't realize you could do that in that field. That was silly of me. Trying this now and will report back.

boona
Tourist
8 0 4

That worked perfectly. Thank you!! I'm so glad I tried using this forum...