đź§© AI Agent + Google Sheets Help

Hi everyone,

I’m currently experimenting with n8n’s AI Agent feature, and I’m facing an issue that I hope someone can help me with.


:wrench: Goal:

I’m building a simple automation for learning purposes:

  • A user sends a message via Twilio (e.g., “Create a Google Sheet called Meeting”).
  • The AI Agent (using Groq as the model) receives the message and extracts the sheet name (“Meeting”).
  • It should return a clean JSON object like this:

json

CopyEdit

{
  "action": "createSpreadsheet",
  "title": "Meeting"
}
  • This JSON should go into the Google Sheets tool node to create the spreadsheet.
  • Finally, I send a confirmation back to the user via Twilio.

:police_car_light: The Problem:

The AI Agent isn’t outputting usable JSON. It often wraps the content in markdown/code blocks or includes extra explanation text — which breaks the Google Sheets node input.


:red_question_mark:What I’m Asking:

  • How can I make the AI Agent return clean, raw JSON only, without code blocks or extra text?
  • Is there a good way to parse or clean the output if needed?
  • Any advice on structuring prompts or flow logic so it works smoothly with the Google Sheets tool?

:brain: I’m currently using Groq (DeepSeek) as the model, but I also have access to Google Gemini (PaLM) API if switching models could help.

Thanks in advance! :folded_hands: Any guidance, examples, or best practices would be greatly appreciated.

Hi there, i think for your case, the google sheets shouldnt be a tool, but the next node after it

and on the ai agent we have this option to make the ai agent to output in. a specific format using an output parser

so your workflow would look something like this

1 Like

Hi, thak you, but how can I make the ai agent pass the json to googlesheets even if the chat model did outpouted json format the ai agent pass it empty or wrong to google sheets node, and second question why can not I add google sheets nodein the tool section on ai agent node??