Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble rendering CSV data as an interactive table in GitHub

Tags:

github

gitlab

When viewed, any .csv file committed to a GitHub repository automatically renders as an interactive table, complete with headers and row numbering. By default, the first row is your header row. The tables were supposed to look nice as below:

enter image description here

However, there's an error happening in my tabular data, and despite indicating the error, I can't fix it:

enter image description here

enter image description here

I'm using a .csv file with a semicolon separator. Does anyone have an idea of what's happening?

like image 615
Nao Avatar asked Oct 27 '25 11:10

Nao


1 Answers

According to the docs, Github can only do its lay-out thing with .csv (comma-separated) and .tsv (tab-separated) files.

Using a semicolon as a separator isn't supported, at least not officially, and a spurious comma in a semicolon-separated file could well throw the algorithm off.

You could try replacing all semicolons with tabs and see how you fare.

If that doesn't work, try using commas as separators and enclose all text table cell data with quotes, like:

"Liver fibrosis, sclerosis, and cirrhosis","c370800","102922","Cystic fibrosis related cirrhosis","Diagnosis of liver fibrosis, sclerosis, and cirrhosis"

Note: no spaces after the commas. Also, if you have quotes in the text fields, you will have to escape those to "" (two quotes), or the algorithm will get confused.

You may get away with using quotes only for the offending text data, but that could well be more difficult to generate than just putting the quotes around all fields.

like image 185
ocrdu Avatar answered Oct 29 '25 01:10

ocrdu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!