I recently discovered that GitHub projects has TSV exports! 💃🏼
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!")
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.
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:
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!