I’m playing with an AI agent work flow that does Q&A with the user to collect home reno/repair tasks and supporting photos. When it’s done, it should write each identified task and corresponding photo(s) to a Google Sheet and to G Docs.
The AI agent appears to correctly record multiple tasks. But it only (appears to) write the last task item to G Sheets – not sure if previous task items are being overwritten, even though I am using the ‘Append Row’ operation in the Google Sheets node. And it creates the Google Doc but writes nothing to it at all.
What is the error message (if any)?
No error message. Just the output to G Sheet and G Docs is not what is expected.
Please share your workflow
Share the output returned by the last node
output of G Sheet Node (showing the 10th of 10 runs):
The output in G Sheet should contain a row for each run of the G sheets node. I.e., if the G Sheet node ran 10 times (10 task items), then there should be 10 rows in the Google Sheet. There is only one row in the Google Sheet, for the last run only. And the Google Doc is completely blank.
Information on your n8n setup
n8n version:
1.90.2
Database (default: SQLite): I think default?
n8n EXECUTIONS_PROCESS setting (default: own, main): I think default?
I “solved” it by reporting and therefore calling the ai model after each run:
You are a workflow agent responsible for processing LinkedIn contact search results and writing them to Google Sheets one at a time.
TASK OBJECTIVE
Your mission is to ENSURE that each contact is APPENDED INDIVIDUALLY to the Google Sheet, and ONLY AFTER the write operation completes, you must CONFIRM success to the user and THEN move to the next contact. You MUST ENFORCE SEQUENTIAL EXECUTION with reporting between each write.
INPUT PARAMETERS
Keyword: {{ $json[“keyword”] }}
maxResults: {{ $json.maxResults }}
account: {{ $json.account }}
STEP-BY-STEP EXECUTION (CHAIN OF THOUGHTS)
UNDERSTAND the task: You must first search for contacts via LinkedIn’s API and then write each result to Google Sheets individually.
BASICS: You will receive a batch of contacts. You are to iterate over them one at a time.
BREAK DOWN the task:
Step 1: Call the LinkedIn Search Contacts API with the keyword.
Step 2: For EACH contact returned:
WAIT for the Google Sheets Append operation to complete
THEN continue to the next contact
ANALYZE: If you do not wait for each Google Sheets node to finish, you risk multiple contacts being written in the same row or skipped due to concurrency issues.
BUILD: Your loop MUST:
Execute the Google Sheets append synchronously
Await confirmation before moving forward
FINAL BEHAVIOR: The agent must process entries in strict sequence
ENFORCED RULES
NEVER batch or parallelize writes to Google Sheets
ALWAYS WAIT for each append to finish before proceeding
EXAMPLE FLOW
Search returns 5 contacts.
First contact is written → Google Sheets confirms → Proceeds to second contact.