seichris / chatgpt-history-export-to-md

A Python script to effortlessly extract and format your ChatGPT conversations data export from JSON files to well-structured markdown files, with YAML metadata headers. And it all happens locally !

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Your entire ChatGPT data in beautiful Markdown Markdown Logo

You can now also try out Word Clouds πŸ”‘β˜οΈ on your data, see graphs πŸ“ˆ of your prompt history, and get all your custom instructions πŸ€– in one place !

GitHub last commit GitHub issues

Welcome to the ChatGPT Conversations to Markdown converter! This Python script helps you to convert your entire ChatGPT history and data export into neatly formatted Markdown files.

It adds YAML headers (optional, included by default), and also includes Code interpreter (Advanced Data Analysis) input / output.

New : Data visualizations, and custom instructions.

ChatGPT Logo

See Examples : Screenshot, Markdown, Word clouds : sample 1 , sample 2.

Quick setup

See Prerequisites. (Just Python and Git, and you're good to go.)

Step 1: Clone the Repository πŸ“₯

Open a terminal or command prompt and run the following command:

git clone https://github.com/mohamed-chs/chatgpt-history-export-to-md.git

Next, navigate to the project directory by using the following command:

cd chatgpt-history-export-to-md

Step 2: Set Up the Environment πŸ› οΈ

Before running the script, you need to set up a virtual environment and install the required dependencies.

First, create a virtual environment:

python -m venv .venv

Activate the virtual environment:

On Windows:

Using Command Prompt (cmd.exe):

.venv\Scripts\activate.bat

Or, if you're using PowerShell:

.venv\Scripts\Activate.ps1

If you encounter an error about script execution in PowerShell, try running:

powershell -ExecutionPolicy ByPass -File .venv\Scripts\Activate.ps1

On Linux or MacOS:

source .venv/bin/activate

After activation, install the necessary packages using:

pip install -r requirements.txt

Step 3: Download Your Conversations data πŸ—‚

Before you run the script, make sure your ChatGPT conversations are in a ZIP file format.

How to download : (click to expand/collapse)
  1. Sign in to ChatGPT at https://chat.openai.com

  2. At the bottom of the left side bar, click on your profile name, the on Settings

    Bottom-left Widget

  3. Go to Data controls

    Settings

  4. In the "Data Controls" menu, click on Export data : Export

    Data Controls

  5. In the confirmation modal click Confirm export

    Confirm Export

  6. You should get an email with your data, in 2 ~ 5 minutes (check your inbox)

    Email

  7. Click Download data export to download a .zip file containing your entire chat history and other data.

    ZIP File Content

    ↑ Collapse


The script will automatically find the most recent ZIP file in your 'Downloads' directory (in ~/Downloads/), but you can specify a different file or location if necessary.

Step 4: Running the Script πŸƒβ€β™‚οΈ

With the environment set up, you can now run the script. In the terminal or command prompt, execute:

python main.py

Now, follow the instructions on screen and choose your desired options, the script will handle the rest.

Step 5: Check the Output πŸŽ‰

And that's it! After running the script, head over to the output folder to see your nice word clouds, graphs, and neatly formatted Markdown files. Enjoy !

tweet your data findings

Tweet

Share Your Feedback! πŸ’Œ

I hope you find this tool useful. I'm continuously looking to improve on this, but, I need your help for that.

Whether you're a tech wizard or you're new to all this (especially if you're new to all this), I'd love to hear about your journey with the tool. Found a quirk? Have a suggestion? Or just want to send some good vibes? I'm all ears!

Here's how you can share your thoughts:

  1. GitHub Issues: For more specific feedback or if you've stumbled upon a bug, please open an issue. This helps me track and address them effectively.

  2. GitHub Discussions: If you just want to share your general experience, have a suggestion, or maybe a cool idea for a new feature, jump into the discussions page. It's a more casual space where we can chat.

And if you've had a great experience, consider giving the project a star ⭐. It keeps me motivated and helps others discover it!

Thank you for being awesome! 🌟

Acknowledgments πŸ™Œ

Massive shout-out to some incredible tools that made this project come to life:

  • matplotlib (repo) for those crisp visuals.
  • nltk (repo) for the NLP magic.
  • pandas (repo) – because who can handle data without it?
  • questionary (repo) for those sleek command line interactions.
  • seaborn (repo) for taking my plots up a notch.
  • wordcloud (repo) for those awesome cloud visualizations.

Thanks to these projects and their contributors for the hard work that went into developing these invaluable tools!

Contributions πŸ†˜

Feel free to fork this repository and make your enhancements or improvements. ALL contributions are welcome !

See CONTRIBUTING.md

See also : my HackerNews post

Prerequisites

Python Logo Git Logo

Make sure you have Python, and Git installed. You can download them from :

Notes

This is just a small thing I coded to help me see my convos in beautiful markdown, in Obsidian (my note-taking app).

I wasn't a fan of the clunky, and sometimes paid, chrome extensions.

I'm working on automating it to add new conversations and updating old ones. Had some luck with a JavaScript bookmarklet, still ironing it out tho. Shouldn't take long.

See TODO.

If you want the last working version with absolutely no external dependencies (no virtual environment needed), you can find it here.

About

A Python script to effortlessly extract and format your ChatGPT conversations data export from JSON files to well-structured markdown files, with YAML metadata headers. And it all happens locally !

License:MIT License


Languages

Language:Python 81.4%Language:JavaScript 18.6%