Skip to main content

Hi there, hoping someone can help me with this formatting issue in zapier. I am automatically importing orders in from Shopify into google sheets. The default is for them to import like this: “Item 1, Item 2, Item 3”. My initial goal was to get them to import like this all in the same cell:

 

Item 1

Item 2

Item 3

 

I successfully did this with the line-item to text utility. See solution below:

 

So all good it seemed, until there are less or more than 3 items in an order. When there are more than 3 items, it only imports the first 3, and when there are less than 3 items, it imports to google sheets like this:

Any solutions? Thanks so much in advance.

Hi @Eric Caldwell!

Welcome to the Zapier Community!

I’d recommend a Code by Zapier step, with a Javascript event set up as in the screenshot (using the copy/paste code below):

var input = inputData.input;

var output = input.replace(/,\s/g, "\n");

output = ={output}];

As you can see from the below screenshots, it works with any number of line items (so long as they don’t have a comma followed by a space in their name.

 


Thanks so much for the reply. Any idea why this isn’t working?

 

 


Oh, in your first example, there were spaces between each element. In this case, delete the \s from the code, and you should be set!


@Eric Caldwell Were you able to try this out?


I sure did! Thanks so much for the help