Shopify Flow inserts all data in one row in Google Sheets

Hi Paul, I am trying to recreate the sample you have given by duplicating the same example data + code, but it returns to this error.


TypeError: Cannot read properties of undefined (reading ‘length’)


result
[email removed] Untitled.gs:14


also, what do you mean by this approach should no longer be necessary if I use the “For Each” loop? is there an alternative way to achieve this without using appscript?

This is my row content on shopify flow:

{{draftOrder.id}},
{{draftOrder.totalPrice}},
{{draftOrder.currencyCode}},
{% for lineItems_item in draftOrder.lineItems %}
{{lineItems_item.name}}::
{{lineItems_item.id}}::
{{lineItems_item.quantity}}##
{% endfor %}