Export AI agent conversation logs from Postgres to Google Sheets
Ready for 3.0What this workflow does
This workflow has 11 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects Postgres and Google Sheets.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Postgres: run a query
- Loop Over Session IDs (Loop Over Items (Split in Batches)): loops over the items in batches
- Clear Sheet Content (Google Sheets): clear
- Get conversations by sessionId (Postgres): select
- Duplicate template sheet (HTTP Request): calls an HTTP API (POST)
- Add conversations (Google Sheets): append
- Rename Sheet (HTTP Request): calls an HTTP API (POST)
- Set session_id (Edit Fields (Set)): sets 1 field: session_id
- add create_at column (Postgres): run a query
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (7)
- Manual Trigger
n8n-nodes-base.manualTrigger - Postgres
n8n-nodes-base.postgres - HTTP Request
n8n-nodes-base.httpRequest - Google Sheets
n8n-nodes-base.googleSheets - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches
From the author
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…