Navigation Menu

CSV File Format

What is a CSV File?

CSV is a simple file format used to store tabular data, such as a spreadsheet or database. CSV stands for Comma-Separated Values. Its data fields are most often separated, or delimited by a comma. A CSV is a text file, so it can be created and edited using any text-editor.


Files in the CSV format can be imported to and exported from programs that store in tables, such as Micorsoft Excel.

In Computers, a CSV file contains the values in a table as a series of ASCII text lines organized so that each column value is separated by a comma from the next column's value and each row starts a new line.

A CSV file is a way to collect data from any table so that it can be conveyed as input to another table oriented application.

For Example, lets assume we have a following data in a spread sheet.



This data could be represented in a CSV format as follows.




What can be CSV's used for?

In e-business, CSV's are used primarily for importing and exporting product, customer and order information to and from your store.

Creating CSV file using Notepad?

Step1: Open Notepad.

Step2: Write the following text.



Step3: Save the file with .csv extension.



Step4 : Open the file with Excel.



In CSV file you just created, individual fields are separated by comma(,).

But if the data itself contains ",", then you can protect those data fields by enclosing them in double quotes("").

Let's assume some data, in which fields of some column contains comma.



To retain the commas in 'NOTES' column, we can enclose those columns in double quotes.



Rules to format data in CSV file

1. Each record should be located in a seperate line.



2. There may be optional header line appearing as the first line of file.


3. After last field, there should not be any comma(,).



4. Each line should contain same number of files through out the file.




5. Each field may or may not be enclosed in double quotes.



6. Fields containing double quotes must be enclosed in double quotes("").






















0 comments: