I have a workflow that processes 11 items through Anthropic Analyze Image nodes. How do I collect all 11 results into one item at the end to create a single Google Doc?

Hi everyone, I have a workflow that processes trading journal screenshots from Google Drive and analyzes them using the Anthropic “Analyze Image” node. The workflow works correctly for a single item, but I’m struggling to collect all results into one Google Doc at the end.

My workflow structure: Schedule Trigger → Code (week number) → Google Drive Search (week folder) → Google Drive Search (date subfolders) → Google Drive Search (images) → Code (group by trade number) → Drive Download Range → Anthropic Analyze Range → Drive Download Trade → Anthropic Analyze Trade → Code (build summary) → [STUCK HERE] → Google Docs Create → Google Docs Update What I’m trying to do: There are 11 trades in this week, each with 2 images (Range + Trade) Each trade gets analyzed by Claude and produces a text summary I want ALL 11 summaries collected into ONE Google Doc.

What I’ve tried:

Loop Over Items node → only outputs 1 item from the done branch
Aggregate node → still only 1 item reaches Google Docs
Summarize node with Concatenate → same result
$(‘Code node’).all() in a Code node with Execute Once → only sees 1 item
Merge node → created 11 separate documents instead of 1

My question: What is the correct way in n8n Cloud (version 2.14.2) to collect all processed items from a loop or sequential processing into a single item at the end of the workflow?

Describe the problem/error/question

I have a workflow that processes 11 items through Anthropic Analyze Image nodes. How do I collect all 11 results into one item at the end to create a single Google Doc?

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.14.2
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): N8N cloud
  • Operating system:

const allItems = $input.all();

let combinedText = ‘’;

allItems.forEach((item, index) => {
combinedText += Trade ${index + 1}:\n${item.json.summary}\n\n;
});

return [
{
json: {
content: combinedText
}
}
];

this is a code that you can use for it .

3 Likes

Your workflow should look something like this

1 Like

the problem is that Execute Once doesn’t aggregate items — it runs the node once with whatever item triggered it and ignores the rest. the right tool here is the Aggregate node placed right after the node that outputs your summary field. configure it to aggregate summary into an array, then in your Google Docs Update use {{ $json.summary.join('\n\n---\n\n') }} to get all 11 results in one block. if you prefer a Code node, $input.all().map(i => i.json.summary).join('\n\n') works too — just without Execute Once, placed after the node where all items flow through at once.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.