title: Is it possible to read multiple csv files with same header or subset of header in same or different order into spark data frame?
body: <p>I have many csv files in a folder to be loaded into spark data frame. They all have either same header or a header which is a subset of the longest header but in different order. </p>
  
  <ul>
  <li>File 1 header - <code>"a","b","c"</code></li>
  <li>File 2 header - <code>"b","c","a"</code></li>
  <li>File 3 header - <code>"a","b"</code></li>
  </ul>
  
  <p>I have a schema that has <code>a,b,c</code> fields. I am trying to read using </p>
  
  <pre><code>sqlcontext.read
    .format("com.databricks.spark.csv")
    .option("delimiter",",")
    .option("header","true")
    .load("file*.csv")
  </code></pre>
  
  <p>Is it possible to read multiple csv files with same header or subset of header in same or different order into spark data frame? Instead of editing file to add or change column order I want to handle it in spark.</p>