I am still getting used to n8n and I am stuck on how to group items in a workflow.
I am doing an (one) API call (via the HTTP node) to get list of all the products sold by an online shop/hub. Now, this shop sells over 1000+ products from 10+ producers/brands.
So, I get 1000+ items in the workflow with each item containing fields such as product name, price, quantity, producer_id etc.
What I want is to group all the items based on their producer_id, so I can generate multiple CSV files with one for each producer containing list of products from that producer.
What’s happening currently is, I am getting one giant CSV file with all the products.
I am using the spreadsheets node for generating a CSV at the end.
Note: This is a simplified explanation of the workflow. The HTTP call gives only 1 item (containing all the products) as an output, then I use split items node to get all the products separately as items.
Also, there is no fixed allocation of products across producers, i.e. producer 1 to 10 can have any number of products linked to them.
I tried using Item List node with Aggregate items option, but there is no way to group items based on a field value (producer_id in my case). Same issue with split in batches node.
Information on your n8n setup
- n8n version: 0.195.5
- **Running n8n via [Docker, npm, n8n.cloud, desktop app]:**n8n.cloud