Extract chat sessions from OpenAI data exports by date and optionally by keyword.
ChatExtract is a command-line tool that helps you:
- View all unique dates with conversation counts from your ChatGPT export
- Extract conversations from a specific date, optionally filtered by keyword in the title
- Generate both JSON and human-readable HTML outputs with markdown rendering
conda env create -f environment.yml
conda activate chatextractpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txtpython chat_extract.py data/Charlie-1This displays:
- All unique dates with conversation counts
- Sample conversation titles from each date
python chat_extract.py data/Charlie-1 -d 2025-10-21This extracts all conversations from that date to extracted/Charlie-1/ with:
conversations.json- Filtered conversations in JSON formatchat.html- Human-readable HTML version of the filtered conversations
python chat_extract.py data/Charlie-1 -d 2025-10-21 -k "python"This extracts only conversations from that date where "python" appears in the title (case-insensitive).
To get your conversations.json file:
- Go to ChatGPT Settings → Data Controls
- Click "Export data"
- Wait for the email with your data archive
- Extract the archive and locate the
conversations.jsonfile
# List all dates with conversation counts
python chat_extract.py data/Charlie-1
# Extract all conversations from October 21, 2025
python chat_extract.py data/Charlie-1 -d 2025-10-21
# Extract only conversations with "python" in the title from that date
python chat_extract.py data/Charlie-1 -d 2025-10-21 -k "python"
# Process a different export
python chat_extract.py data/Another-Export -d 2025-09-15ChatExtract/
├── data/
│ └── Charlie-1/ # Your OpenAI export (renamed)
│ ├── conversations.json
│ ├── chat.html
│ └── ...
├── extracted/
│ └── Charlie-1/ # Output folder (created by tool)
│ ├── conversations.json # Filtered conversations (JSON)
│ └── chat.html # Filtered conversations (HTML)
├── chat_extract.py
└── README.md
- Python 3.8+
- See
requirements.txtfor package dependencies
MIT