From TSV to CSV: How GitHub Copilot Chat Made Data Conversion a Breeze!

Kedasha - Aug 29 '23 - - Dev Community

I recently discovered that GitHub projects has TSV exports! šŸ’ƒšŸ¼

projects-export-tsv

I was super excited about this but it also made me realize that some folks may want/prefer csv files and so, I asked by bestie - GitHub Copilot Chat - to help me convert a TSV file to a CSV file in Python.
Now, I'm not a Python Developer, so I wasn't sure how I would do this in Python, and while I could use an npm module like PapaParse to accomplish this, I wanted to try another language.

Honestly, it was pretty seamless!

Here's how I did it:

Step 1: Download your TSV file and add it to a folder, then open said folder in VSCode (or your preferred editor).

Step 2: Create a new Python file, I called mine tsv_to_csv.py.

Step 3: Navigate to GitHub Copilot Chat and ask "how do I convert a tsv file to csv with python?"
I was provided with the following code:

import csv

with open('ruby-study-guide.tsv', 'r') as tsvfile:
    reader = csv.reader(tsvfile, delimiter='\t')
    with open('ruby-study-guide.csv', 'w', newline='') as csvfile:
        writer = csv.writer(csvfile)
        for row in reader:
            writer.writerow(row)
    print("Conversion complete!")
Enter fullscreen mode Exit fullscreen mode

If you're not familiar with GitHub Copilot Chat, read this blog post to learn how to get started with it.

Step 4: Paste the code into your file by clicking the "Insert at Cursor" icon.
insert at cursor icon GitHub Copilot Chat interface

Step 5: Save your file, run the code with python <<name of your file here>>, for example python tsv_to_csv.py, and enjoy your csv file!

Here's a video/gif on the steps I did above:

convert tsv to csv with Github copilot chat


Now that you know that GitHub Projects has TSV exports, learn more tidbits that you possibly didn't know by reading this blog post I wrote on 10 things you didn't know you could do with GitHub Projects.

Let me know if you have any questions about GitHub Copilot or GitHub Projects below!

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .