Help with Connecting Google Sheets or Airtable to AI Agent in n8n

Hi everyone,

I’m trying to connect Google Sheets or Airtable with an AI agent in n8n, but I’m a bit lost. When working with tools like Wikipedia, it’s pretty straightforward to pull information—just connect and go. However, with Google Sheets and Airtable, I understand that I may need to create a schema or some kind of structure to properly pull data, but I’m not sure where to start or what exactly I need to do.

Is there a tutorial or guide on how to set this up, specifically using the Google Sheets or Airtable nodes (not the HTTP nodes)?

Any advice or resources would be greatly appreciated!

Thanks in advance!

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @nusquama
Is it possible to share the workflow you’re trying to build? It’ll help in understanding where you’re getting stuck and if agents + nodes as tools are the best way to solve your problem.

Here are some pointers which might help.

1. Nodes-as-tools requiring no AI Agent input

A great thing about nodes-as-tools are that you can just attach them to agents which little to no extra configuration - of course, you’ll need to set the credentials and say for google sheets, the location of the sheet.

In this example, the agent has a google sheets tool attached. The google sheet is a schedule for the London Rowing Club Program 2024 (check out the sheet here). When prompted, the agent will pull in all rows from this sheet as context to answer your question.

2. Nodes-as-tools requiring AI Agent Inputs

In our previous example, the sheet contains little data so fetching the all the rows is acceptable because there’s not much to process. But if if we had 100x the rows and columns? Here’s where filtering makes sense and having the agent define the value of the filter would be required.

For nodes-as-tools, we don’t actually define a input schema (directly anyway) for the agent, instead we can use the $fromAI() expression. It’s pretty new but very easy to grasp - simple make up a variable name of what you want the agent to input.

For example (note: you can make-up any name, you do not need to define these anyway other than in the expression and you don’t need to reuse them for other dynamic inputs if you don’t want to!)

Say in the google sheet filters I wanted to filter by the season column, I would just use the following expression to get the agent to fill in this “season” value.

{{ $fromAI('season') }} // the agent will use an existing season name or generate a new one

Here it is in action, the tool now returns a subset of the data.

3. Nodes-as-tools more Advanced $fromAI() usage

Ok, one final thing pointer and this one is to do with Airtable. So we should know by now that $fromAI() is how we get the AI Agent to input values into our tools but these values don’t need to be simple data types like text or number, they can be other complex types like formulaes as well!

This example uses my Pitchdecks Airtable. Here, I’m asking the Agent to generate a “filter by formula” query to let it decide how best to search the database.

  • When asked “Who are the investors for Wework?”, the {{ $fromAI('filter_by_formula') }} generated the following formula {Name}='Wework'.

Hope this helps!

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.