Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > PowerShell Function to Extract ChatGPT Conversations
May 23
PowerShell Function to Extract ChatGPT Conversations

Hey there, PowerShell enthusiasts and fellow M365 admins! I’ve been tinkering around with a little something I think you'll find helpful, especially if you've been playing around with OpenAI's ChatGPT. I have been and let me tell you, this has been a wild ride.

Meet Format-ChatGPTConversation, it’s a function I wrote that takes your ChatGPT conversation history and formats it into a more digestible output. If you've been in the trenches with ChatGPT, you know that it can be tough to share your conversations with other people. You have to take a bunch of screenshots or just copy out individual parts. Neither of those are any fun. That's where this function comes into play.

Now, you might be thinking, "That's great, but where do I find these ChatGPT conversations?" Good news! You can get the conversations.json file right from the OpenAI chat interface. Just head over to, click on the three dots by your name in the lower left corner, and navigate to "Settings". Once you're in there, click the "Data controls" tab, and voila! There's an "Export" button waiting for you. Clicking that will give you a zip file, and nestled inside it is your conversations.json file.

So what does Format-ChatGPTConversation actually do? Well, it processes this JSON file, extracting relevant conversation details like the title, ID, create time, author, and content. Any system messages or messages without an author are left out. We don't need them muddying up our beautiful output, do we?

Let's talk about how to use this bad boy. You can pipe it to the console, save the formatted output to a text file, pass multiple JSON files through the pipeline, or even group the output by conversation title. Here are a few examples:

Format-ChatGPTConversation -filename "conversations.json"

Format-ChatGPTConversation -filename "conversations.json" | Out-File -Filepath "formatted_conversations.txt"

Get-ChildItem -Path "conversations.json" | Format-ChatGPTConversation

Format-ChatGPTConversation -filename conversations.json | Group-Object -Property Title | Select-Object name, count

And if you're feeling particularly adventurous, you can even select specific conversations and format them in a list:

Format-ChatGPTConversation -filename conversations.json | Where-Object { $_.title -eq "PowerShell Function Advice" } | select author, content | Format-List |


All of those examples are included in the Examples in the function. You can get to them with help Format-ChatGPTConversation -Examples after you’ve downloaded and imported it.

Ain't that a sight for sore eyes? It's like finding a pearl in an oyster. The world of PowerShell and ChatGPT is your oyster, my friends. Go forth and explore.

How do you get this marvel of modern technology? Go to my PowerShell repo on Github and download it. Then use Import-Module to import it into your PowerShell session.

As always, I'd love to hear how you're using this function. Are you finding it helpful? Have you made any tweaks or improvements? Let's have a conversation about our ChatGPT conversations. It's like Inception, but with less Leonardo DiCaprio and more PowerShell.

Until next time,





Play Baccarat Safely with Baccarat Dispatch: 100% Scam Verification. Learn more about and our commitment to user safety.온라인바카라
 on 10/2/2023 5:33 AM

Re: PowerShell Function to Extract ChatGPT Conversations

Seize the opportunity to invest in luxury living at Cape Royale™ in Sentosa Cove. Click here to access our brochure and floor plans, ensuring you make an informed decision. Contact our hotline at 6100 8187 to learn about exclusive discounts and direct developer prices for 2023.
 on 10/3/2023 9:17 AM


Unveil the secrets behind your favorite stars' fortunes at Dusk Vibes. Click here to learn more about celebrity net worth, age, and more.
 on 10/5/2023 4:31 AM

Re: PowerShell Function to Extract ChatGPT Conversations

Castle Windshield Replacement: Your trusted source for Austin TX windshield replacement. We offer mobile windshield replacement services for your convenience. Click here to learn more.
 on 10/5/2023 5:06 AM


Need in Chicago? Permit Studio is your go-to resource for a quick and hassle-free experience. Click here to explore our services.Building Permits
 on 10/7/2023 2:17 AM


Are you on the lookout for a premium online gaming experience that combines safety, variety, and top-notch entertainment? Look no further than Tentenbet, the exclusive  domain that brings you an extraordinary selection of games and betting options, making it a standout among its peers in the industry.10X10BET
 on 10/10/2023 2:43 AM

Re: PowerShell Function to Extract ChatGPT Conversations

This can be consequently lovely along with inventive. I merely enjoy your hues along with anyone becomes the idea inside snail mail are going to be cheerful.Blue Vibe CBD Gummies
 on 10/10/2023 2:50 AM

Re: PowerShell Function to Extract ChatGPT Conversations

Jim Fannin, the expert <motivational business speaker, offers proven mental coaching. Explore more about his Life Blueprints for success here.
 on 10/11/2023 2:05 AM

Re: PowerShell Function to Extract ChatGPT Conversations

Coastal HSA: Your Employee Health Benefits Solution: Transform your traditional health benefit plans into flexible Health Spending Accounts with Coastal HSA. Explore our website to learn more and take control of employee health spending.
 on 10/11/2023 2:17 AM

Re: PowerShell Function to Extract ChatGPT Conversations

Welcome to the future of modern living at jden Residences™@Jurong East Central 1! If you're searching for a sophisticated, comfortable, and convenient living space in the heart of Singapore, your quest ends here. In this article, we'll delve into what makes J'Den Residences™ an exceptional choice for both homebuyers and investors.
 on 10/15/2023 7:19 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.


Body *

Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person


Want a message when I reply to your comment? Put your Twitter handle here.