Can a CSV file have a comment?

前端 未结 7 1374
悲&欢浪女
悲&欢浪女 2020-12-02 16:29

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 als

7条回答
  •  渐次进展
    2020-12-02 16:44

    If you need something like:

      │ A                              │ B
    ──┼────────────────────────────────┼───
    1 │ #My comment, something else    │
    2 │ 1                              │ 2
    

    Your CSV may contain the following lines:

    "#My comment, something else"
    1,2
    

    Pay close attention at the 'quotes' in the first line.

    When converting your text to columns using the Excel wizard, remember checking the 'Treat consecutive delimiters as one', setting it to use 'quotes' as delimiter.

    Thus, Excel will split the text at the commas, keeping the 'comment' line as a single column value (and it will remove the quotes).

提交回复
热议问题