Create CSV Files for Analysis in 5 Minutes with ChatGPT

ChatGPT is exceedingly versatile, and one thing it can do is produce CSV files. This tutorial originated from a reader’s inquiry about Excel practice files. I mistakenly thought ChatGPT could produce these. At present, neither version of ChatGPT can create downloadable XLSX files. You can use the CSV data with Microsoft Excel. While my initial request failed, I did learn from it.

The Starting ChatGPT 4 Prompt

For context, I wanted ChatGPT to create all the data for this exercise. I also didn’t want to rely on ChatGPT besides Browse with Bing, which is back online.  I first wanted to see if creating the file was possible. I asked:

Are you able to provide me with a downloadable Excel file if I give you my data requirements? The file should use the .xlsx format.

My initial GPT4 prompt request.
My initial prompt using ChatGPT 4.

The reply was positive, although I wasn’t sure what constituted a “simple Excel file.” I should’ve asked, but I figured it meant one worksheet and no pivot tables.

As a side note, you can use ChatGPT 3.5 for this exercise without plugins. However, there are some differences that I’ll outline.

Defining the Excel Requirements

By design, this task was easy. I wanted a spreadsheet of state capitals and various data elements. I figured this information was easily available and seldom changed. My next prompt was:

Thanks. I would like a spreadsheet with a row for each US state. The columns should be:

  • NAME
Second prompt with my requirements.
My follow-up prompt

The sample data looked promising. While not shown in the image above, I could see the sources ChatGPT Plus used while it extracted the data. I can even see some of the extracted data. 

ChatGPT shows sample data from my prompt.

So far, this looks encouraging. 

Too Good To Be True

Even before entering another prompt, ChatGPT Plus came back and apologized. It seems it can’t create the files, but it can tell me how to do it. 

ChatGPT reply indicating no Excel.

Now, I can tell from the earlier response ChatGPT 4 had extracted the data for three states. 

Moving to Plan B – Online Table

While disappointed, I didn’t want to give up. Moreover, I did not want to enter the state data manually, so I asked if I could get a table. 

State data in online table.

Again, this was encouraging, but I only got the three states from before. So, I asked for the other 47. As you see below, ChatGPT continues on the 4th state. For some reason, the format changed. 

State data reformatted with additional states.

I now have all my state data, but those pipe signs will require configuring the Text to Columns Wizard, which I used in the how to split first and last names in Excel tutorial. I then thought about seeing if I could get a CSV file.

Making a CSV File

Given the output above, I was confident I could get a CSV file. All the same, I did ask.

CSV output of all 50 states in ChatGPT.

Good enough. All I needed to do was click the Copy code link in the top-right corner.

ChatGPT Plugins

One advantage to ChatGPT Plus is there is a plugin store. These are third-party applications but not created by OpenAI.  If I search the store, I can see some plugins related to CSV files. While I didn’t use any of these, they may offer a small advantage. While I copied and pasted the data to VS Code, these plugins may make the workflow easier. My preference is not to add plugins if I don’t have to.

Differences Between OpenAI ChatGPT 3.5 & 4

While the results were the same between the two ChatGPT models, there were some differences.  

  • ChatGPT 3.5 was faster 
  • ChatGPT 3.5 told me on my initial prompt it couldn’t create Excel files (.xlsx)
  • ChatGPT 3.5 produced a file similar to the plaintext one with pipe signs, except it was YAML.
  • ChatGPT 4 provided more detailed instructions on copying the file.
  • ChatGPT 4 provided source information.
ChatGPT4 provided sources for state data.
ChatGPT 4 did provide the sources for the state data.

On balance, if you don’t need to know the data sources, I’d choose ChatGPT 3.5. It’s free and is faster. Obviously, this depends on what type of data you need. If you need more current data, ChatGPT 4 would be a better option. Regardless of your chosen version, the service is good at creating CSV data files you can use within Excel or Google Sheets.