Read, Parse and display CSV (Comma separated value) data using Jquery

In this tutorial, you can read the csv file content and display in a textarea with the help of Jquery.

FileReader will fetch the contents from the csv file using the file upload.

To get the csv data, you will need to upload the .csv file. When the csv file is loaded FileReader read the data and show the results.

I am using Jquery FileReader that fetches the contents from the csv file.

The following screenshot displays the UI being displayed in the browser:-


Demo Code

Add Folder:-

1. Create new folder – csv

Add File:-

1. Add file in csv folder – index.html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<html xmlns="" xml:lang="en" lang="en">
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta http-equiv="content-language" content="en" />
		<title>Get CSV Data</title>
		<script src=""></script>
		<script type="text/javascript">
				var ext = $("input#notification_email_id").val().split(".").pop().toLowerCase();
				if($.inArray(ext, ["csv"]) == -1){
					alert('Please upload CSV file');
					return false;
				if( != undefined){
					var reader = new FileReader();
					reader.onload = function(e){
						var csv_value=""+csv_val+"".split(",");
						var input_data="";
						for(var i=0;i<csv_value.length;i++){
							var temp=csv_value[i];
							var input_data=input_data+""+temp;
						final_input_data = input_data.slice(0, -1);	
				return false;
		<table border="0">
				<td><b>How to read data From CSV file using jquery?</b></td>
				<td><textarea class="form-control" name="notification_email" id="notification_email" rows="4" placeholder="CSV file only" cols="40" readonly="readonly" required></textarea></td>
				<td><input name="notification_email_id" id="notification_email_id" type="file" class="" accept=".csv" /></td>

The following screenshot displays the CSV file being displayed in the browser:-


Download Link – CSV file


Leave a Reply

Your email address will not be published. Required fields are marked *