https://github.com/mohamed-chs/chatgpt-history-export-to-md Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} mohamed-chs / chatgpt-history-export-to-md Public * Notifications * Fork 0 * Star 52 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 52 stars 0 forks Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Discussions * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Security * Insights mohamed-chs/chatgpt-history-export-to-md This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 2 branches 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone mohame] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @mohamed-chs mohamed-chs ~ ... 8405323 Sep 24, 2023 ~ 8405323 Git stats * 63 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Update pylint.yml September 23, 2023 21:12 .vscode ~ September 23, 2023 20:41 demo config yaml header September 23, 2023 15:53 images ~ September 23, 2023 11:38 javascript ~ September 24, 2023 21:55 src ~ (added js bookmarklet) September 24, 2023 20:24 .gitignore ~ (added CONTRIBUTING) September 24, 2023 21:31 CONTRIBUTING.md ~ September 24, 2023 21:57 LICENSE Create LICENSE September 16, 2023 22:01 README.md ~ September 25, 2023 00:38 config.json config yaml header September 23, 2023 15:53 main.py ~ (added js bookmarklet) September 24, 2023 20:24 project_layout.txt ~ (added CONTRIBUTING) September 24, 2023 21:31 requirements.txt commit September 21, 2023 16:10 View code [ ] Your entire ChatGPT data in beautiful Markdown See Examples : Screenshot, Markdown, Markdown with dollar signs, Chat link. Quick setup Step 1: Clone the Repository Step 2: Download Your Conversations data Step 3: Running the Script [?] Step 4: Check the Output Optional: Customize the Script's behavior command line parameters config.json Issues and contributions Enjoy Your Conversations in Markdown! Prerequisites TODO Notes README.md Your entire ChatGPT data in beautiful Markdown Markdown Logo 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. ChatGPT Logo See Examples : Screenshot, Markdown, Markdown with dollar signs, Chat link. Quick setup See Prerequisites. (just Python and Git and you're good to go. No external dependencies !) 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: 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 3: Running the Script [?] In the terminal or command prompt, run the script with this command: python main.py The default output location for the Markdown files is : ~/Documents/ ChatGPT-Conversations/MD/. The script will automatically create the directories if they didn't exist. Feel free to customize the script's behavior. Step 4: Check the Output And that's it! After running the script, check the output folder for your neatly formatted Markdown files. Optional: Customize the Script's behavior command line parameters Feel free to customize the script's behavior using additional parameters: * --out_folder: Specify the output folder where the MD files will be saved. * --zip_file: Specify the ZIP file containing the ChatGPT conversations to be converted. Here is an example command: python main.py --out_folder "Obsidian_Vault/Chats" --zip_file "My downloads/my_chat.zip" This will extract and look for the conversations.json file in ~/My downloads/my_chat.zip, and create the MD files in ~/Obsidian_Vault/ Chats. (on Windows, ~/ refers to C:/Users/{your_username}/). config.json You can also modify the config.json file, to customize the output : { "system_title": "System", "user_title": "YOUR NAME", "assistant_title": "My AI", "tool_title": "Code output (or plugin name)", "delimiters_default": true } Change "delimiters_default" to false to replace all $\LaTeX$ bracket delimiters : \(...\) and \[...\], with dollar sign ones : $...$ and $$...$$, if you'd like your math to render beautifully in Markdown readers that support MathJax (like Obsidian). You can also configure the YAML header in the config.json to add or remove fields. Issues and contributions See CONTRIBUTING.md. Feel free to fork this repository and make your enhancements or improvements. ALL contributions are welcome ! If you encounter any issues or have questions, feel free to open an issue / discussion. Enjoy Your Conversations in Markdown! Hopefully, you find value in this tool. If you do, giving it a star on the repository would mean a lot. Thank you! Prerequisites Python Logo Git Logo Make sure you have Python (version >= 3.10), and Git installed. You can download them from : * Official Python website * Official Git website Yep, no external dependencies needed. TODO Doing what needs to be done. Feel free to add or check items. general * [*] keep external dependencies to a minimum (0 so far) * [*] Javascript to download more conversations, see Javascript * [ ] Add new downloaded conversations to the MD folder * [ ] Update past conversations if changed * [ ] More robust testing setup * [ ] Data visualizations : chat times, frequency, models, word clouds, etc... * [ ] Data analysis : categories and more classifications based on topics, concepts, programming tools, etc ... * [ ] Integration with Obsidian (folders and subfolders, tags, ...) * [ ] Add HTML as an output option * [ ] Format more content data, for example : plugin use * [ ] Support different response selections in a chat * [ ] Extract more data from the JSON files, like user feedback per message * [ ] Option to add metadata for each individual message * [ ] more todos ... command line * [ ] Nicer command line output formatting * [ ] More configs from the command line (overwrite the config.json) * [ ] Link to submit issues or feedback * [ ] more todos ... configs.json * [*] change user, assistant, and system names * [*] yaml header elements * [ ] specific configs for each individual conversation / conversation type * [ ] output folder (currently set by default or via command line arguments) * [ ] more configs ... See also : JavaScript Todo 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. 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 ! Topics python markdown export json zip conversations bookmarklet history openai advanced-data-analysis obsidian-md code-interpreter chatgpt Resources Readme License MIT license Activity Stars 52 stars Watchers 2 watching Forks 0 forks Report repository Releases No releases published Packages 0 No packages published Languages * Python 74.0% * JavaScript 26.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.