wadetb / Sublime-Text-Advanced-CSV

Efficiently format, edit, arrange, and evaluate cells in CSV files
169 stars 14 forks source link

Skip comments #49

Open cbrown1 opened 6 years ago

cbrown1 commented 6 years ago

Hi, Nice plugin. I use csv files with comments at the top, and it would be great if those could be skipped when justifying the rows. Here is an example:

# This is a comment at the top of a csv file # There may be more than one comment line ` Header1,Header2,Header3 data1,data2,data3 data-a,data-b,data-c`

justinmcgrath commented 5 years ago

I do this as well, but I also uses rows to include units and descriptions for nonobvious columns. If it didn't justify any comment, then those wouldn't get justified. I can't think of a straightforward way to sensibly choose whether to justify. Maybe only justify if the row contains delimiters?

# Data collected from blah blah.
#, , , Above ground yield.
#, , , kg / m^2
line_id, plot_id, year, yield
WT S NN, A, 2014, 0.439595491985597
WT S NN, B, 2014, 0.375006810619682
cbrown1 commented 5 years ago

I have seen this handled in other contexts (eg., numpy import) with a parameter to specify the comment character, and in which '#' is almost always the default. Any line that starts with any of the specified comment characters is skipped. The other way (looking for delimiters) often doesn't work because comments could contain that character.