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 is 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