Skip to content
Trouble appending r...
 
Notifications
Clear all

Trouble appending rows in Google Sheets or writing to Google Docs

4 Posts
4 Users
0 Reactions
3 Views
h3ppyg00se55
(@h3ppyg00se55)
Posts: 1
New Member
Topic starter
 

Describe the problem/error/question

I am experimenting with an AI agent workflow designed to engage users in a Q&A process to gather information about home renovation and repair tasks, along with supporting photos. Upon completion, the workflow should document each identified task and its associated photos into a Google Sheet and a Google Doc.

The AI agent seems to be correctly identifying multiple tasks. However, it appears to only write the last task item to Google Sheets, and I'm unsure if previous task items are being overwritten, despite using the 'Append Row' operation in the Google Sheets node. Additionally, it creates the Google Doc but doesn't write any content to it.

What is the error message (if any)?

There are no error messages. The output to Google Sheets and Google Docs is simply not as expected.

Please share your workflow

Share the output returned by the last node

Output from the Google Sheets Node (displaying the 10th of 10 runs):

json
[
{
"response": [
{
"DESCRIPTION_OF_WORK": "Large mold issue in guest bedroom closet, approximately 2 feet across; no previous remediation steps taken; requires mold assessment and remediation.",
"PHOTOS": "=IMAGE("https://storage.googleapis.com/download/storage/v1/b/n8n_photos/o/%2F?generation=1746201857072247&alt=media")"
}
]
}
]

Output from the Google Docs Node (unhelpful):

json
[
{
"response": [
{
"kind": "drive#file",
"id": "1qv1li-l0NDDdN6wjCuysH_9rNAs3AnEFtRNHTj4X2dc",
"name": "n8n Report Output",
"mimeType": "application/vnd.google-apps.document"
}
]
}
]

The output in Google Sheets should include a row for each execution of the Google Sheets node. For instance, if the Google Sheets node ran 10 times (representing 10 task items), there should be 10 rows in the Google Sheet. Currently, there is only one row, corresponding to the last execution. The Google Doc remains entirely blank.

Information on your n8n setup

  • n8n version:
    1.90.2
  • Database (default: SQLite): I believe it's the default.
  • n8n EXECUTIONS_PROCESS setting (default: own, main): I believe it's the default.
  • Running n8n via (Docker, npm, n8n cloud, desktop app): n8n cloud
  • Operating system: Sequoia 15.3.2 (24D81)
 
Posted : 02/05/2025 9:55 pm
stevethm
(@stevethm)
Posts: 1
New Member
 

I encountered a comparable problem previously. Enabling the Google Drive API and switching the operation to 'append or update' resolved it for me.

 
Posted : 03/05/2025 12:04 am
Lorenz_Wieseke
(@lorenz_wieseke)
Posts: 2
New Member
 

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)

  1. UNDERSTAND the task: You must first search for contacts via LinkedIn’s API and then write each result to Google Sheets individually.

  2. BASICS: You will receive a batch of contacts. You are to iterate over them one at a time.

  3. 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
  4. 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.

  5. BUILD: Your loop MUST:

    • Execute the Google Sheets append synchronously
    • Await confirmation before moving forward
  6. 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

  1. Search returns 5 contacts.
  2. First contact is written → Google Sheets confirms → Proceeds to second contact.
  3. Repeat until all contacts are processed.
 
Posted : 15/05/2025 11:55 am
georgerobots
(@georgerobots)
Posts: 1
New Member
 

I encountered the same issue, and this solution proved effective. Much appreciated!

 
Posted : 16/05/2025 6:36 am
Share: