A collection of Python scripts to help manage and organize ChatGPT conversation exports from OpenAI. These tools help you clean, split, and index your ChatGPT conversations for better organization and searchability.
When you export your ChatGPT conversations from OpenAI, you get a single JSON file containing all your conversations. This project provides tools to:
- Clean and analyze your conversations
- Split them into individual markdown files for better readability
- Create a searchable index of your conversations
- Help you decide which conversations to keep or delete
For example, you can add the generated Markdown files into a private Obsidian vault.
- Chat Cleaner (
chat_cleaner.py): Generates a CSV overview of all conversations with metadata and previews - Chat Splitter (
split_chats.py): Converts the JSON export into individual markdown files and optionally creates a searchable SQLite database
- Clone this repository:
git clone [repository-url]
cd chatgpt-export-tools- Ensure you have Python 3.6+ installed
First, export your ChatGPT data from OpenAI:
- Go to ChatGPT settings
- Click "Export Data"
- Download the export
- Extract the file sent over by OpenAI
- In the extracted files you'll receive a
conversations.jsonfile which is used by this script.
To get an overview of all your conversations:
python scripts/chat_cleaner.py conversations.jsonThis creates a chats.csv file that you can open in Excel/Google Sheets or import into Notion. The CSV includes:
- Conversation ID
- Title
- Creation time
- Last activity
- Number of messages
- Preview of the conversation
To split your conversations into individual markdown files:
python scripts/split_chats.py conversations.jsonExperimental Feature: Full-Text Search Database
You can optionally create a searchable SQLite database using the
--ftsflag:python scripts/split_chats.py conversations.json --ftsThis will create a
chats.dbfile with a full-text search index. Note that this feature is currently experimental and hasn't been thoroughly tested. The core markdown file generation works independently of this feature.
Output:
out/directory containing individual markdown files (namedYYYY-MM-DD_title-slug.md)chats.db(if using--fts) - A SQLite database with full-text search capabilities (experimental)
.
├── scripts/
│ ├── chat_cleaner.py # Generates CSV overview of conversations
│ └── split_chats.py # Splits conversations into markdown files
├── exports/ # Place your OpenAI export here
└── out/ # Generated markdown files
This tool is provided as-is for processing your own ChatGPT conversation exports. Users are responsible for:
- Ensuring they have the right to export and process their ChatGPT conversations
- Complying with OpenAI's terms of service regarding their data
- Protecting their privacy and the privacy of others when processing conversations
- Using the tool responsibly and ethically
The MIT License below covers the code itself, but does not override or modify any terms of service or privacy requirements from OpenAI or other services.
This project handles ChatGPT conversation exports which may contain sensitive information. Here are some security practices we follow:
- The tools process data locally and don't transmit any data externally
- All generated files (markdown, CSV, SQLite) are stored locally
- Review your ChatGPT exports for sensitive information before processing
- Be careful when sharing generated files
Before submitting changes, please check for potential security issues:
- Using Gitleaks (recommended):
docker run --rm --name=gitleaks -v $PWD:/src zricethezav/gitleaks:v7.6.1 gitleaks protect --path=/src --verbose- Manual checks:
- No hardcoded credentials or API keys
- No sensitive data in commits or PRs
- No external data transmission
- No data storage outside local files
MIT License
Copyright (c) 2024 [Your Name]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contributions are welcome! Please feel free to submit a Pull Request.
Note: Reviews may take time as this project is maintained in my free time.
- OpenAI for providing the ChatGPT export functionality
- The Python community for the excellent libraries used in this project