How to handle multilines coming from CSV file in a quoted string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2019 10:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 04:17 AM
Hi @Mounica Vemulapalli
Do you mean how to handle multilines in the source csv file? While using spark.read API, did you try including the multiline option set to true? please try and let us know how it goes
.option("multiLine","true")
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2019 04:47 AM
@Mathan Pillai .. Yes I tried it.. But in the file, multiline of a column is considering as row itself
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2019 03:07 AM
Hi,
Can you try escape parameter & quote parameter to indicate which characters need to be ignored. The escape character within the quotes will be ignored. you can specify the newline character, that it needs to be ignored. please refer to below documentation for more info
https://docs.databricks.com/spark/latest/data-sources/read-csv.html#reading-files
: by default the quote character isquote
, but can be set to any character. Delimiters inside quotes are ignored."
: by default the escape character isescape
, but can be set to any character. Escaped quote characters are ignored.\
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 04:42 AM
In my case all three options are not working. still I am facing issue data is not properly separated
escape
.option("multiLine","true")
quote

