Exporting Fulfilled orders data to google sheets

Chris140223
Visitor
2 0 1

Hi guys, apologies, i'm a bit new here.

I have set up a flow in shopify flow (on plus) as follows:

 

[Trigger] when order is fulfilled > [Action] add row to a google sheet.

 

I'm trying to export shipped order line items data to a google sheet for reporting, but i'm finding it difficult to add the correct variables to reflect a standard orders csv export (e.g. Name, Email, Currency, Subtotal, Taxes etc).

 

I've figured a few variables out (e.g. {{order.name}}), but its a bit trial and error. 
Does a reference library of order variables exist? I've been using Mark Dunkley's shopify cheat sheet but can't find anything relating to order variables.

 

Any help would be much appreciated. thanks so much,

Replies 10 (10)

JJ9519
Tourist
5 0 0

Would also love to know the answer to this! Just getting started with Shopify Flow and I also need to append order variables to different parts of the google sheet, but can't figure out how to do this. 

paul_n
Shopify Staff
946 128 225

There is a button to "Add a variable". Click that and choose the variable. It will insert the proper liquid for that variable. Some things like lineItems require looping so it will insert a loop. If you choose another variable for a lineItem, it will insert another loop, so that point you need to just grab the variable name. One thing to keep in mind is that Flow follows the GraphQL Admin API. So if you look at those docs, the names will be exactly the same.

 

https://shopify.dev/docs/api/admin-graphql/2023-01/objects/order

 

Finally, if you are trying to send each line item to a row in sheets, I'd recommend using a For Each loop to loop over the line items and call "Add a row" for each line item

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
FiberRhythm
New Member
4 0 0

"Finally, if you are trying to send each line item to a row in sheets, I'd recommend using a For Each loop to loop over the line items and call "Add a row" for each line item"

I am trying to do just that (Send each line item to a row in sheets). But when I try to add the "For Each" to loop over the line items, the line items list is not showing up as an option in the flow builder. I would think after I have done the getOrderData, I could add a For Each and it would allow me to select the Line Items to loop over. It is not showing that as an option. Am I missing a step? It would be very helpful to have a flow example of a for each over an order's line items. I can't find an example of what the flow should look like. 

 

paul_n
Shopify Staff
946 128 225

You cannot loop over nested listed yet (like Orders / LineItems). It also may not be advisable to call an API like that...you could end up calling the Sheets API thousands of times in a very short window (which is one of the reasons we don't have that feature yet). 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
FiberRhythm
New Member
4 0 0

OK. I can see that, but then what did you mean by : I'd recommend using a For Each loop to loop over the line items and call "Add a row" for each line item"
I don't see how to do that in the Flow interface.

paul_n
Shopify Staff
946 128 225

If you are using an Order trigger, then you don't need to loop over Orders.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
FiberRhythm
New Member
4 0 0

True. My situation is slightly different. I wanted to use a schedule trigger to pull down all order/line items that occurred in the last week (my volumes are low). I can see how using the order trigger for future orders might work better.

paul_n
Shopify Staff
946 128 225

I think it's better to stream these 1x1 than do them in big batches, as long as the trigger works for you.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
FiberRhythm
New Member
4 0 0

Thanks so much! Going to set up the by order flow next

Anna_Anna
Visitor
2 0 0

Have you considered using a third-party tool for such tasks? For example, Coupler.io might be a perfect solution for you. The only thing, it wouldn’t work by a trigger (like order fulfillment) but by a schedule: Coupler supports automated data refresh feature that can be set up in a way of custom schedule, so you can choose how often your data should be refreshed (minimum every 15 minutes).