Non ci sono articoli nel tuo carrello.
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.
n8n_chat_histories
table with an AI Agent connected to it. If you need an example, you can follow this tutorial
created_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:ss
user_id
) by overriding session_id
in your memory config.