This tutorial explains sample CSV file examples with or without headers

Sample CSV file example with headers

CSV file contains multiple rows, each row contains attributes or columns separated by columns

The first line contains the header of columns separated by a column.

In the below example,

The header or first column contains id, name, salary, and department. Second row onwards, the data of columns are separated by a comma. Here is a CSV sample file with headers

id,name,salary,department
1,john,2000,sales
2,Andrew,5000,finance
3,Mark,8000,hr
4,Rey,5000,marketing
5,Tan,4000,IT

Sample CSV file example without headers

The header or first row of columns is optional.

Each row contains columns separated by a comma.

Here is a CSV sample file without headers

1,john,2000,sales
2,Andrew,5000,finance
3,Mark,8000,hr
4,Rey,5000,marketing
5,Tan,4000,IT

How do I create a sample CSV file?

A CSV file is a text file with multiple rows, each row contains comma-separated values

  • Open any notepad
  • Add multiple rows of data
  • Where each row contains multiple columns delimited by a comma
  • Save this file as a sample.csv file