Hi everyone, I’m just starting to learn this amazing tool, n8n, and I’m trying to build a chatbot that can give users information about certain products, including price calculations.
I have an OpenAI node connected to a Google Sheets tool.
In this Google Sheet there’s a list of all the products (a very long list), and when I ask the OpenAI chat for information about a product I get this error:
“400 ‘tool_outputs’ too large: the combined tool outputs must be less than 512 KB.”
Looking at the Google Sheet output in Executions, I see that it returns the entire sheet with no filters every time. How can I set a filter so it only returns the rows I want?
Unfortunately, because I’m using an AI Tool node, I can’t place any other nodes in between. What can I do?
The error you’re seeing happens because the Google Sheets node is sending back the entire spreadsheet, which is way too much for the OpenAI Tools Agent to handle.
Instead of connecting the whole sheet directly to the AI Agent, try this:
Before your AI Tool node, add a Google Sheets node.
In the Sheets node use “Read Rows” operation.
Apply a filter so it only returns the row(s) matching the product the user asked about.
Now connect the AI Tool node to that filtered data.
Alternatively you can set a sub-workflow to get only one rows at the time
If I put the Google Sheet before the AI node, how will I know what information the user is looking for? Wouldn’t it be better to let the AI interact first and then have it query the sheet directly?
Another workflow is probably the right solution, but I’d like to keep everything inside the existing workflow to avoid spreading things out. Should I use an HTTP Request for that?
I tried using filters directly in the Google Sheet with the “Defined automatically by the model” option, but the output comes back empty:
if the user’s input is unstructured, it does make sense to let the AI interpret it before the sheet.
Option 1: Two-step logic in a single flow
Let the AI extract the product name from the user’s question.
You can use the AI Tool just for this step (e.g., prompt: “Extract the product name from this message.”).
Save the result (e.g., “finestre”) (are you Italian? ) in a field like productName.
Then use that productName to query Google Sheets with a filtered request, just like before.
This keeps everything in one single workflow.
Option 2: Direct Sheet lookup by AI
You mentioned trying to let the AI query the sheet directly using the “Defined automatically by the model” option, but you’re getting an empty result. That usually means the table headers in Sheets weren’t clear or structured enough. Make sure the first row has clean field names (e.g., “product”, “price”, “category”).
The AI prompt didn’t provide enough context or structure to generate a useful filter. You can help the AI with a clearer system message or example.
Something like:
“You have access to a spreadsheet with products. Use the ‘product’ column to find the row that matches the user’s request.”
Also: If you’re getting “values0_Value” etc. in the output, it likely means your sheet doesn’t have proper column headers. Add them in row 1, and n8n will use them automatically.
Btw no need to use an HTTP Request unless you’re calling an external API.
Google Sheets can handle this fine with the regular Sheets node, you just need a bit of logic around filtering or structuring the data first.