title: How to read a .csv with multiple lines in spark - scala?
body: <p>I am trying to read a .csv file with multiple lines in a record in spark-scala.</p>
  <pre><code>id ,name
  3221,uhbjh
  12233,&quot;My name is 
  ydbc&quot;
  2333,jdhv
  </code></pre>
  <p>I was using the below code initially, which returns more records because of multiple lines in a record</p>
  <pre><code>val df = spark.read
        .option(&quot;header&quot;, &quot;true&quot;)
        .option(&quot;sep&quot;, &quot;,&quot;)
        .option(&quot;inferSchema&quot;, false)
        .csv(s&quot;${file_path}&quot;)
  
  returns:
  
  |  id |       name|
  +-----+-----------+
  | 3221|      uhbjh|
  |12233|My name is |
  |ydbc&quot;|       null|
  | 2333|       jdhv|
  +-----+-----------+
  
  Schema as:
  
  scala&gt; df.printSchema()
  root
   |-- id : string (nullable = true)
   |-- name: string (nullable = true)
  </code></pre>
  <p>When I figured out there are multiple line records, I have used</p>
  <pre><code>val df = spark.read
        .option(&quot;header&quot;, true)
        .option(&quot;sep&quot;, &quot;,&quot;)
        .option(&quot;inferSchema&quot;, false)
        .option(&quot;multiLine&quot;, true)
        .csv(s&quot;${input_file}&quot;)
  
  returns:
  
  +-----+----------------+
  |  id |           name
  +-----+----------------+
  | 3221|          uhbjh
  |12233|My name is
  ydbc|
  | 2333|            jdhv|
  +-----+----------------+
  
  Schema as:
  
  scala&gt; df.printSchema()
  root
   |-- id : string (nullable = true)
  : string (nullable = true)
  </code></pre>
  <p>Any help with what options should I use to overcome this issue?</p>