Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between a .csv and a .txt file

Tags:

c#

csv

What is the difference between these two file format.

i found this from Here

.txt File: This is a plain text file which can be opened using a notepad present on all desktop PCs running MS Windows any version. You can store any type of text in this file. There is no limitation of what so ever text format. Due to ease of use for end users many daily data summery providers use .txt files. These files contain data which is properly comma seperated.

.csv File: abreviation of "comma seperated values" This is a special file extension commonly used by MS Excel. Basically this is also a plain text file but with a limitation of comma seperated values. Normally when you double click this type of file it will open in MS Excel. If you do not have MS Excel installed on your computer or you find Notepad easy to use then you also can open this file in a notepad by right clicking the file and from the menu select "Open With" and then choose notepad.

My Question :

  • what does means comma seperated value?
  • if i'm going to create .csv file using c#, does i need to write file using StreamWriter and does it need to only change the the extention to .csv?
  • if so do i need to change the writing string with commas?

thanx....

like image 743
DevT Avatar asked Jan 31 '13 06:01

DevT


People also ask

Can a TXT file be a CSV?

Converting text files to CSVFor PC, head to the "File" menu, and choose "Save as". You'll type in the name of your file, and add the extension ". csv". This will automatically change it to CSV format!

Is CSV better than txt?

In CSV file we can able to store categorical of data because of it formate which is not possible in the text file so in case of categorical data CSV is faster than text.

What is a TXT file used for?

A text file is used to store standard and structured textual data or information that is human readable. It is defined in several different formats, including the most popular ASCII for cross-platform usage, and ANSI for Windows-based operating platforms.

Why would you use a CSV file?

CSV files are plain-text files, making them easier for the website developer to create. Since they're plain text, they're easier to import into a spreadsheet or another storage database, regardless of the specific software you're using. To better organize large amounts of data.


1 Answers

what does means comma seperated value?

Values separated by Comma, for example.

Name,Id,3,Address

if i'm going to create .csv file using c#, does i need to write file using StreamWriter and does it need to only change the the extention to .csv?

Changing extension of the file will help you in opening it in MS Excel, other than that it can be anything and you can still open it through your code (StreamReader)

if so do i need to change the writing string with commas?

Yes, separate your values with Comma, or you can use any other delimiter you like. It can be semicolon ; as well since , in some languages/cultures is used for decimal separator.

like image 58
Habib Avatar answered Sep 24 '22 01:09

Habib