Block 1 - When clicking ‘Test workflow’
- Type / Role
- n8n-nodes-base.manualTrigger - manualTrigger
- Config choices
- Version 1
This workflow is provided as-is. Please review and test before using in production.
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 agen...
n8n-nodes-base.manualtrigger, n8n-nodes-base.postgres, n8n-nodes-base.httprequest, n8n-nodes-base.googlesheets, n8n-nodes-base.scheduletrigger, n8n-nodes-base.stickynote, n8n-nodes-base.set, n8n-nodes-base.splitinbatches
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Agent Studio.
Original n8n.io sourceThis 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.
n8n_chat_histories table with an AI Agent connected to it. If you need an example, you can follow this tutorialcreated_at column (see Setup > Add a datetime column)This workflow expects a Google Sheets file where each session will be stored in its own tab. A basic tab layout is duplicated and renamed with the session ID. 👉 Use this template as a starting point Note: You can hide the template after the first tabs have been created
Trigger The workflow can be launched manually or on a schedule (e.g. daily at noon).
Retrieve sessions
Runs a SQL query to get distinct session_id values from the n8n_chat_histories table.
Loop over sessions For each session:
session_id.Fetch messages Selects all messages linked to the session from Postgres.
Append to sheet Adds each message to the Google Sheet with columns:
user, assistant, etc.)created_at, formatted yyyy-MM-dd hh:mm:ssuser_id) by overriding session_id in your memory config.This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
| Workflow | Export AI agent conversation logs from Postgres to Google Sheets |
|---|---|
| Complexity | advanced |
| Nodes | 23 |
| Categories | Document Extraction |
| Author | Agent Studio |
| Published | 28 May 2025 |
Use the JSON export at /data/workflows/4464/4464.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
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 agen...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.