I got the solution. Thanks to @LarsKotthoff for your help.

Finally I get my data like this:

// My header
var headers = ["date","type","brand","model","price"].join(",");

// First I get the file or URL data like text
d3.text("myPath", function(error, data) {
  // Then I add the header and parse to csv
  data = d3.csv.parse(headers +"\n"+ data); ... });

Hope that it helps!

Related Query

More Query from same tag