RobotsHelp

n8n Auto Fill Spreadsheet AI: Build It in 7 Steps

Written by

in

You have a sheet with 300 rows. Column A holds the raw stuff: company names, customer comments, job titles, product descriptions. Columns B to D are empty and waiting for a category, a short summary, a priority. You can fill them by hand. It takes an afternoon, and next week there are 40 new rows.

An n8n auto fill spreadsheet AI workflow does that filling for you. A new row arrives, n8n sends the text in that row to an AI model, the model returns the values you asked for, and n8n writes them into the empty cells of the same row. You build it once, test it on a handful of rows, and then you only review the results.

No password needed – your reset opens instantly.

No password. Just your email, and you’re in.

New to learning AI for your daily work? Join Launchpad free on the home page and get started in small steps.

What this workflow does

The workflow has four parts that always stay the same, whatever the sheet is about:

  1. A Google Sheets trigger notices a new or changed row.
  2. An AI step reads the text in that row and returns fixed fields.
  3. A small cleanup step makes sure the answer fits your columns.
  4. A Google Sheets update step writes the answer into the same row.

Typical jobs for it: sorting customer comments into topics, giving each lead a one-line summary, tagging expenses with a category, cleaning up messy job titles, or drafting a first reply for each support request. Anything where one cell of text should produce another cell of text is a fit.

It does not do math for you. If you want a formula that sits inside the sheet, the page on a Google Sheets AI formula generator is the better route. If you want to ask questions about a finished sheet, see how to analyze a spreadsheet with ChatGPT. This page is about filling empty cells automatically as data comes in.

What you need before you start

  • An n8n account, either the cloud version or one you run yourself. If you have never opened it, the n8n tutorial for beginners takes you through the editor first.
  • A Google account with a sheet you can edit.
  • An API key for an AI model, such as OpenAI or Anthropic. n8n stores it as a credential, so you paste it once and never put it in the workflow itself.
  • Ten test rows with real text in them.

Set up the sheet first

Spend five minutes here and the rest goes smoothly. Use one header row, and keep the headers short and without spaces, for example comment, category, summary, priority, status.

The status column matters most. It starts empty. When the workflow has filled a row, it writes “done” there. That gives you a simple way to see what was processed and a way to stop the workflow from touching a row twice.

Add one more column for a row number or an ID, if your data has none. n8n needs one column with unique values to know which row to update. A plain number from 1 upward is fine.

Step by step in n8n

1. Add the Google Sheets trigger

Create a new workflow and add the Google Sheets Trigger node. Connect your Google account, pick the spreadsheet and the tab, and choose the event “Row added”. The trigger checks the sheet on a schedule you set, so a new row is picked up within the interval you choose, not at the exact second you type it.

If your data is pasted in as a batch, “Row added” will fire once for each new row. That is what you want.

2. Skip rows that are already done

Add an IF node. Set the condition to: status is empty. Rows that pass go on to the AI step. Rows that already say “done” stop here. This keeps you safe if you later switch the trigger to “Row updated”, because writing results into a row would otherwise trigger the workflow again in a loop.

3. Send the text to the AI

Add an OpenAI node (or the Anthropic node, if you use Claude). Choose the option that sends a message to the model. Put the text from the row into the prompt with n8n’s expression syntax, which looks like this in the prompt field: {{ $json.comment }}.

The prompt decides how good the results are. Here is one that works for sorting customer comments. Change the categories to your own.

You sort customer comments for a small online shop.
Read the comment below and answer with JSON only, using exactly these keys:
- category: one of "shipping", "product quality", "pricing", "support", "other"
- summary: the comment in one plain sentence, max 15 words
- priority: "high" if the customer is angry or threatens to leave, otherwise "normal"

If the comment is empty or unreadable, use "other" for category and "unclear" for summary.

Comment:
{{ $json.comment }}

Three details in that prompt do most of the work. The list of allowed categories stops the model from inventing a new label for every row. The word limit keeps summaries short enough for a cell. And the line about empty comments gives the model a safe way out, so it does not make something up.

Set the temperature low, around 0 to 0.3 where the node offers it. For sorting and tagging you want the same answer for the same text, not creativity.

4. Turn the answer into columns

The model returns text that looks like JSON. Add a Code node or an Edit Fields (Set) node to parse it. The simplest option is a short Code node that reads the model’s answer, runs JSON.parse on it and returns the three values as separate fields: category, summary, priority.

Models sometimes wrap JSON in extra words or code fences. If parsing fails now and then, tell the prompt to answer with JSON only (as above), and add a fallback in the Code node: when parsing fails, set the category to “other” and the status to “check”. A row marked “check” tells you a human needs to look. That beats a silent empty cell.

5. Write the results back to the row

Add a second Google Sheets node, this time with the operation “Update Row”. Pick the same spreadsheet and tab. Choose the ID column as the column to match on, and map the fields:

  • category gets the category value from the previous step
  • summary gets the summary
  • priority gets the priority
  • status gets the fixed text “done”

The n8n documentation lists the Google Sheets operations, including Update Row and Append or Update Row, and how matching works: see the n8n Google Sheets node documentation. If your sheet has no unique ID and you would rather match on the comment text, “Append or Update Row” can do that, but unique IDs are safer because two customers can write the same sentence.

6. Test with ten rows

Click “Execute workflow” and add one test row. Watch each node light up and open its output. Check three things: did the AI return what you asked for, did the parsing give you clean fields, and did the right row get updated?

Then paste in your ten real test rows and read every result. Look for the odd cases: very short comments, comments in another language, comments that contain two complaints. Fix the prompt for whatever goes wrong, and run the same ten rows again.

7. Switch it on

When the ten rows look right, activate the workflow with the toggle at the top. From then on every new row gets filled in without you opening n8n.

Fill existing rows that are already in the sheet

The trigger only sees new rows. If you already have 300 rows waiting, build a second small workflow for the backlog: a manual trigger, a Google Sheets node with “Get Row(s)” and a filter on empty status, then the same AI and update steps. Put a Loop Over Items node in front of the AI step with a batch size of 5 to 10, and add a Wait node of a few seconds inside the loop. That keeps you under the rate limits of the AI provider and of Google Sheets.

Run it on 20 rows first. Then run it on the rest. Bulk runs are where a bad prompt gets expensive, so test small.

What it costs

You pay for the AI calls, and for n8n if you use their cloud plan. A comment of a few sentences is a small request for a model, so a few hundred rows usually cost very little, but prices differ per model and change over time. Check the current price list of the provider you use, and run your first 20 rows while looking at your usage page, so you see the real cost before you run 3,000 rows.

Make the results more reliable

  • Use a closed list. Every column that should hold a label needs a list of allowed values in the prompt. Free text in a category column makes filtering impossible later.
  • Give two or three examples in the prompt: a comment and the exact JSON you want back. Examples fix formatting problems faster than extra instructions.
  • Keep one column called status and let the workflow write “done” or “check”. You can filter the sheet on “check” and clear your doubts in a minute.
  • Add a Sticky Note inside the workflow that says what it does and which prompt version it uses. In three months you will not remember.
  • Never send data to an AI model that you are not allowed to share. Customer names, medical or financial details need a decision from you or your company first. Remove or hide them in an earlier step if you can.

Common problems

The workflow runs twice on the same row

This happens when writing to the sheet counts as a change and the trigger is set to “Row updated”. Use the IF node from step 2, or keep the trigger on “Row added”.

The update goes to the wrong row

The match column has duplicate values. Add a column with unique IDs and match on that.

The cells stay empty

Open the Update Row node and compare the field names with your headers. A header with a trailing space or a different capital letter is enough to break the mapping. Rename the header in the sheet and reload the columns in the node.

The AI gives answers that are close but not right

Tighten the prompt. Add the allowed values, add one example, and describe edge cases in plain words (“if the customer mentions a refund, the category is pricing”). Change one thing at a time and rerun the same ten rows.

Where to go next

Once the sheet fills itself, the next step is usually what happens to the data afterward. Two pages on this site pick up from here. The n8n invoice processing workflow pulls data out of invoices and files it, and the page on automating email follow-up with n8n turns a sheet of leads into messages that go out on time. If your sheet is fed by a form or another tool, the n8n webhook tutorial shows how to push rows into it automatically. And if you use Zapier instead, there is a Zapier workflow that sends invoices to Google Sheets.

When you want to learn this kind of automation step by step, with someone showing the next move, start with the free Launchpad.

No password needed – your reset opens instantly.

No password. Just your email, and you’re in.

Questions people ask

Can n8n fill a spreadsheet with AI for free?

You can self-host n8n on your own computer or server without a plan fee, and Google Sheets is free. The AI model is the part that usually costs money, per request. Some providers have a small free tier, so check theirs.

Does this work with Excel instead of Google Sheets?

n8n has Microsoft Excel nodes too, and the same shape applies: trigger, AI step, cleanup, update. Setup and permissions differ because Excel runs through a Microsoft account, so follow the n8n documentation for that node.

Can the AI fill a whole column at once?

Row by row works better. Each row gets its own request, so one odd entry cannot spoil the rest, and you can see which row failed.

Will it overwrite what I typed myself?

Only if you let it. The IF node in step 2 lets through rows with an empty status, so rows you filled by hand and marked “done” are left alone.

🇳🇱 Deze pagina in het Nederlands  ·  🇩🇪 Diese Seite auf Deutsch