Export AI Agent Conversation Logs from Postgres to Google Sheets — n8n Workflow

Medium complexity Trigger11 nodes👩‍💻 IT Ops👁 485 viewsby Agent Studio

Overview

Overview This n8n workflow retrieves AI agent chat memory logs stored in Postgres and pushes them to Google Sheets, creating one sheet per session. It’s useful for teams building chat-based products or agents and needing to review or analyze session logs in a collaborative format.

Who is it for Anyone with an AI Agent in Production storing the conversation logs in Postgres (or Supabase) who wants to see transcript and have control Product teams building AI agents or assistants. Teams that want

Nodes used

Google SheetsHTTP RequestPostgres

Workflow Preview

Add a datetime column
If not already done, add a `created_at` column to store
👉 Ideally, do it before your first interaction, otherw
For Supabase users
Although in theory you could use Supabase native nodes,
Get your Supabase credentials
1. Go to your
Get all sessions
In this node, we execute a SQL query that collects all
Replace the name of your chat memory before executing t
Important - How it works
- Each time this workflow is executed, all conversation
- The reason is that the sessionID can be overrid
Loop over each session
This node iterates over each session and add it in a se
Google Sheets template
https://docs.google.com/spreadsheets/d/14bKI5J0h18Nv48j
Setup
👉 Make sure to double check these steps before launchi
Clear Google Sheet content
This will clear each Google Sheets data in order to hav
Error path: the error path is actually normal, it happe
Create a new Google Sheet based on a template
This part of the workflow prepares a fresh sheet for ea
What it does:
Clear Sheet Content
Clears t
Store transcripts in Google Sheets
This section writes each session's messages into its co
What it does:
* Appends new rows to the sheet named after the `sessio
* Each
Triggers
Test it manually, then, once validated, create a schedu
Your choice!
Store n8n AI Agent Memory Logs in Google Shee
Overview
This n8n workflow retrieves AI agent chat memory logs s
W
When clicking ‘Test work…
add create_at column
Get conversations by ses…
Duplicate template sheet
Clear Sheet Content
Rename Sheet
S
Schedule Trigger
S
Set session_id
Postgres - Get session ids
L
Loop Over Session IDs
Add conversations
11 nodes11 edges

How it Works

  1. 1

    Trigger

    The workflow starts with a trigger trigger.

  2. 2

    Process

    Data flows through 11 nodes, connecting googlesheets, httprequest, manualtrigger.

  3. 3

    Output

    The workflow completes its automation and delivers the result to the configured destination.

Node Details (11)

GO

Google Sheets

googleSheets

#1
HT

HTTP Request

httpRequest

#2
PO

Postgres

postgres

#3

How to Import This Workflow

  1. 1Click Download JSON button on the right to save the workflow file.
  2. 2Open your n8n instance. Go to Workflows → New → Import from file.
  3. 3Select the downloaded export-ai-agent-conversation-logs-from-postgres-to-google-sheets file and click Import.
  4. 4Set up credentials for each service node (API keys, OAuth, etc.).
  5. 5Click Test Workflow to verify everything works, then activate it.

Or paste directly in n8n → Import from JSON:

{ "name": "Export AI Agent Conversation Logs from Postgres to Google Sheets", "nodes": [...], ...}

Integrations

googlesheetshttprequestmanualtriggerpostgresscheduletriggersetsplitinbatches

Get This Workflow

Download and import in one click

Download JSONView on n8n.io
Nodes11
Complexitymedium
Triggertrigger
Views485
CategoryIT Ops

Created by

Agent Studio

Agent Studio

@agentstudio

Tags

googlesheetshttprequestmanualtriggerpostgresscheduletriggersetsplitinbatches

New to n8n?

n8n is a free, open-source workflow automation tool. Self-host it or use the cloud version.

Get n8n Free →