AI Agent receives input with 2 rows but only gives output for 1

Describe the problem/error/question

I am creating an Email AI agent that receives data from a Google sheet. The data contains typical information, eg Names, email etc.

What is the error message (if any)?

There is not error but when I execute the workflow, I see that Agent only executes data in the only the first row. I have tried adding a function prior to the AI Agent node but that also does not resolve the problem
return $input.all().map(row => ({
json: row.json // Ensures each row is processed
}));

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“jsCode”: “return $input.all().map(row => ({\n json: row.json // Ensures each row is processed\n}));\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
220,
0
],
“id”: “709fc11b-02bb-4ebf-8fd0-8bde5d667ab6”,
“name”: “Code”
}
],
“connections”: {
“Code”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “05ab2e005385e63a17812b018733edaf6a9046a0adbeddfbb8538f588ee3b39a”
}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

[
{
“output”: “The email introducing Devendra Narayan’s Signature Pranayama Workshop has been successfully drafted and saved as a draft in Gmail. If you need any further assistance or have more studios to reach out to, just let me know!”
}
]

Information on your n8n setup

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

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:
  • n8n version: 1.77.3
  • Database (default: SQLite): Default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Mac12.7.6

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