I am refactoring the data in/out in a project and after finishing the in for csv files,
I am asking myself with no answer: what is the difference between csv and txt files ?
In the old times, I would say
that a Row have a Tab delimiter (between two Columns) and ends with a Return character.
But after seeing the file PropertyData.txt *, I am dubious.
- This file was shared on the Tadpole conversation.
A TXT (text) file is a file with text in it, ie no pictures. Usually ANSI characters but now extended to Unicode too.
The extension TXT tell you NOTHING about what the file contains.
A CSV file implies ‘comma separated values’. eg 1,2,Fred,Green,29
It should consist of data items, with a comma in between them.
Some files use “” around text items that hold a comma, so that you know “17,435” is supposed to be 17,435 and not two fields where one is “17 and the other is 435”
Tabs between fields is NOT a CSV file. Some people call that a TSV file, some just use TXT as the extension.
Thanks Jeff: you wrote what I think (more or less).
Doubts comes when I saw csv data in a txt file (as the one I told above).
Then more doubts when I read people talking about Excell export files in csv using ‘;’ or ‘:’ as field delimiters
Thus my question.
BTW: before asking the question, I fired LibreOffice and check there
the delimiters are
comma, semi-colon, colon, space, tab (for a csv file).
[checking the previous used mechanism] I export data in a txt file using \tab as field delimiter.
Other takers ?
csv data in a txt file
A TXT (text) file is a file with text in it. Some of them may be commas. That doesnt make it a CSV file.
But if it has comma separated values, then it is a comma-separated values file, even if someone called it .TXT
If the extension is CSV, then it SHOULD have commas in it, but some call “tab delimited files” CSV.
And you can call a text file .BANANA if you like.
You can NOT rely on the file extension of a TXT or CSV file to tell you how the contents are formatted.
But that said, if LibreOffice allows colons as the delimiter in a CSV file, they should be shot.
CSV has become standard nomenclature for any TEXT file that contains data known to be seperated into fields by a predefined delimiting character, be that a comma, a tab, a pipe |, colon or anything else
All CSV files are text files, but not all text files are CSV files