A chatbot talks. An agent does things.

The smallest useful agent I know of in n8n does one thing a chatbot can't: you ask it for three social media post ideas, then you say "save those to the sheet", and three rows appear in Google Sheets with every column filled in.

Getting the first part working is easy. Getting the second part to land in the right columns, every time, comes down to one design decision that most tutorials skip: the system prompt's output format and the spreadsheet's header row are the same schema, and you should write them together.

This is the build from my free interactive lesson, plus the part that makes the column mapping reliable.

The six parts

Almost every n8n agent I've built uses the same shape:

Slot Node Why
Trigger On chat message Gives you a chat box to talk to the agent
Agent AI Agent Plans the work and decides when to call a tool
Instructions System Message (an option on the AI Agent) Who the agent works for and what format to return
Model OpenAI Chat Model The thinking. gpt-5-mini is plenty for this
Memory Simple Memory So "those ideas" refers to something
Tool Google Sheets Tool, Append Row The action

On the AI Agent node, each of Chat Model, Memory and Tool has its own + underneath. Click it and pick the piece.

Step 1: Design the schema first

Before you touch n8n, decide what one "idea" looks like. For a made-up agency, BrightPath Marketing, it's five fields:

Platform | Post Topic | Hook | Description | Call to Action 

Those five strings go in two places, spelled identically:

  1. Row 1 of the sheet. Create a spreadsheet called Social Media Ideas and type the headers in A1:E1.
  2. The system message. Tell the agent to return exactly those fields.

A system message in this shape works well (adapt the company details):

You generate social media post ideas for BrightPath Marketing, a small marketing agency for local service businesses. Voice: friendly, practical, no hype. For every idea, return exactly these fields: - Platform (LinkedIn, Instagram or Facebook) - Post Topic - Hook (one line) - Description (2-3 sentences) - Call to Action When the user asks you to save ideas, use the Google Sheets tool and write one row per idea, putting each field in the column with the same name. Never invent a column. 

The last paragraph does two jobs. It tells the agent when to use the tool (only when asked to save), and it ties each field to a column by name.

Step 2: Wire the agent

  1. Create workflow, then Add first step → On chat message. Nothing to configure; close it.
  2. Click the + on the trigger → AI Agent.
  3. In the agent, Add Option → System Message, paste your prompt.
  4. + under Chat Model → OpenAI Chat Model. Create a credential with your OpenAI API key, or, on a new n8n Cloud account, pick n8n's free credits from the credential list and skip the key. Model: gpt-5-mini.
  5. + under Memory → Simple Memory. Defaults are fine.
  6. + under Tool → search Sheets → Google Sheets Tool.

About the OpenAI key, since it trips up a lot of people: the API at platform.openai.com is billed separately from a ChatGPT subscription, and a key on an account with no credit just returns errors. Add credit first ($10 lasts a long time for this), then create the key, and copy it immediately. OpenAI shows it once.

Step 3: Let the model fill each column

In the Google Sheets Tool:

  • Credential: Google OAuth (sign in, allow Sheets and Drive access).
  • Operation: Append Row.
  • Document: Social Media Ideas. Sheet: Sheet1.

n8n reads the header row and shows one field per column. Next to each one is a small sparkle button: let the model define this parameter. Click it for all five.

What that does under the hood is set the field to a $fromAI() expression. You can also type it yourself, which lets you add a description the model sees:

{{ $fromAI('Platform', 'LinkedIn, Instagram or Facebook', 'string') }} {{ $fromAI('Hook', 'One-line opening sentence for the post', 'string') }} 

The signature is $fromAI(key, description, type, defaultValue). The key is the name the model uses when it calls the tool; the description is a hint. Adding descriptions is the cheapest reliability upgrade you can make on any agent tool.

Step 4: Test it in two messages

Click Open chat at the bottom of the canvas.

  1. Give me three social media post ideas for BrightPath Marketing. You should get three ideas, each with all five fields. If you don't, fix the system message before going further.
  2. Save those ideas to the sheet. The agent calls the Sheets tool three times. Three rows land, one per idea.

Open the execution log and expand the tool calls. You'll see the arguments the model sent for each column. That's where you debug mapping problems.

Why it works (and why it fails)

It works because the model never has to guess. The prompt says "return Platform, Post Topic, Hook, Description, Call to Action". The tool exposes parameters with those exact names. Matching them is trivial.

It fails in a few predictable ways:

  • "Save those" saves nothing useful. No memory. Each model call stands alone, so "those" points at nothing. Add Simple Memory.
  • Text lands in the wrong column, or one column gets everything. The prompt's field names don't match the headers. CTA in the prompt and Call to Action in the sheet is enough to break it.
  • The agent saves on the first message. The prompt doesn't say when to use the tool.
  • Errors on the model node. API key with no credit, or the key was pasted with a trailing space.
  • A new column appears to be ignored. n8n reads the headers when you configure the node. Re-open the tool and refresh the columns after changing row 1.

Reuse the pattern

Swap the company and the five fields and it's an idea log for blog topics, email subject lines, ad angles or product descriptions. Anything you ask ChatGPT for today and then paste into a spreadsheet by hand fits this shape. Once the schema habit clicks, adding a second tool (Gmail, Calendar) is the same move: name the fields once, use them everywhere.

If you want to do it click by click before touching your own accounts, I built a free interactive version that runs in a practice copy of n8n, OpenAI and Google Sheets (72 checked steps, nothing billed): n8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets.