What is a CSV file and what is its purpose?
CSV stands for Comma-Separated-Value. It is used to store tabular data in plain text. As the name suggests each value is separated by a comma. This format is widely used to move data from one program to another.
Let us consider the following Employee table.
This data can be stored in a file with .csv extension using simple notepad.
Steps to represent above employee table data in a .csv file using notepad:
- Open Notepad application.
- Type the following:
- Save it as a .csv file. (say demo.csv)
- Open this file with MS Excel to see the data in tabular form.
- First line should be the names of columns
- Table values should then follow.
- Each one of these have to be separated by comma.