Is there any official way to allow a CSV formatted file to allow comments, either on its own line OR at the end of a line?
I tried checking wikipedia on this and also RFC 4180 but both do not mention anything which leads me to believe that it's not part of the file format so it's bad luck to me and I should then use a seperate ReadMe.txt file thingy to explain the file.
Lastly, i know it's easy for me to add my own comments in, but i was hoping that something like Excel could just import it straight away with no need for a consumer to have to customize the import process.
So, thoughts?
I think the best way to add comments to a CSV file would be to add a "Comments" field or record right into the data.
Most CSV-parsing applications that I've used implement both field-mapping and record-choosing. So, to comment on the properties of a field, add a record just for field descriptions. To comment on a record, add a field at the end of it (well, all records, really) just for comments.
These are the only two reasons I can think of to comment a CSV file. But the only problem I can foresee would be programs that refuse to accept the file at all if any single record doesn't pass some validation rules. In that case, you'd have trouble writing a string-type field description record for any numeric fields.
I am by no means an expert, though, so feel free to point out any mistakes in my theory.