Retrieving and updating multiple Google Sheet rows using a basic LLM chain

Describe the problem/error/question

I’m trying to get rows from my Google Sheet, have a basic LLM chain fix the content of one of the columns, and then save it back to Google Sheets.

I have thousands of rows in my sheet and so I don’t want to overwhelm Google’s APIs so I created a loop and it works fine when I am batching it with one item each time but I’m not sure how to do this with larger batches for example 50 records at a time.

How do I get the basic LLM node to process 50 items at a time and return it in a format that will allow me to bulk update all the rows in Google Sheets?

Please share your workflow

Information on your n8n setup

  • n8n version: 1.90.2
  • Database (default: SQLite): Postgress
  • n8n EXECUTIONS_PROCESS setting (default: own, main): not sure
  • Running n8n via (Docker, npm, n8n cloud, desktop app): self hosted
  • Operating system: Windows

Hey @fancy-llama, welcome to the community!
great question and a really solid use case.
If you want to process 50 rows at a time, here’s my opinion:

1. Use the “Split In Batches” node
Set the batch size to 50. This lets you work with your data in chunks, giving you better control over how much you’re sending to the AI and to Sheets in each loop.

2. Write your prompt to handle multiple items

Most LLMs can handle an array of objects, so you just need to format the prompt accordingly.
Something like:

“Fix any spelling mistakes in the ‘description’ field for each of the following products…”

3. Reformat the output
After the AI step, use a “Set” or “Function” node to reshape the response so it matches the format you need for updating the sheet.

4. Write back to Google Sheets
If you’re updating existing rows, the “Update Rows” operation works well, just make sure you’re passing the correct row reference.

i also recommend putting a “wait” node to rewrite the records on Google Sheet because, from experience, you could saturate the API.