what is csv file?
A CSV (Comma Separated Values) file is a text based format that represents the data typically found in a spreadsheet or a database table.
It is a common format for data interchange as it is simple, compact and ubiquitous. It will open into Excel with a double click and nearly all databases have a tool to allow import from CSV. It is also readily parseable with simple code.
The basic format is defined by a rows of column data. Each row is terminated by a newline to begin the next row. Within the row each column is distinguished by a comma. Data within each column can be double quoted to escape embedded commas in the data. Embedded double quotes are escaped with a pair of double quote characters.
What is the benefit of a CSV file?
Since you ask, I assume you already know what the acronym stands for – CSV – Comma Separated Values
- CSV is a very well established text file format – so much so that many applications recognise .CSV as a distinct and meaningful file name suffix
- A lot of software will recognise the suffix as indicating a set of data records delimited by commas between field/column values with carriage returns delimiting rows of this uniformly represented data.
- Typically you can use it as a simple file-based export format to transfer small – medium sets of data between applications
- You can view/edit it in any plain text editor
- You have to establish what the fields are, either by convention between the programs sharing the data or by the alternative convention of using the first row in the file to establish column headings
- You will also need to specify by convention between the parties as to what characters are acceptable for use within the file – typically plain ‘ascii’
- Any columns that contain data that includes commas or carriage returns tends to f-up the format
- Due to this, if you do need to have these significant characters in the data then you need to agree on a different specification e.g. tab-separated or ‘|’ (pipe separated),
- Alternatively you could also establish a convention for either escaping the significant chars or e.g. by specifying some other ‘quoting’ mechanism
- For anything other than very basic data sharing you are going to need to ‘enhance’ the csv format one way or another.
- So not much good at transferring data with text fields as opposed to simpler types like char or number
How to create csv file?
There are a few ways to create CSV files. The easiest way to do it is to use Excel. Most people use Excel anyway because it’s the default program to open CSV files. The default delimiter in Excel is a comma (,), but you can manually change it to other delimiters. This also depends on your region.
You can create a CSV file manually in Excel.
- Create a new document in Excel.
- Add a column header for the information you want to record (for example, first name, last name, email address, phone number, and birthday), and then enter the data in the appropriate columns.
- Select A File > Save as.
- In the drop-down list, select “CSV (comma delimited) (*.csv)”, name the file, and click Save.
What can I used to a create csv file?
Listing the tools that can create a .csv file is difficult without knowing where the data is coming from. As stated elsewhere, any text editor can create a .csv file. Word, Libre Writer, notepad++, etc. If you want to create a .csv file from plain text, then batch editing programs like sed can also be used. I use sed in cmd using *nix utilities. Please note that GIT has a full if not complete set of binaries that can be used in cmd to format plain text to .csv. I have used C, C++, Basic, Bash to create .csv. Which tool to use, under which circumstances, depends on the data that needs to be converted.
How do you convert a CSV file into a PDF?
Open your CSV file in Excel
File>Open >Location of CSV file
Then you can see the data of the CSV file
Now you convert it to PDF by saving in pdf format
File> Export> Create PDF