kantan.csv
kantan.csv copied to clipboard
Optional header field
I'm processing a csv file with X number of columns which are not all mandatory i.e some of them are optional.
csv.asCsvReader[Foo](rfc.withHeader)
object Foo {
implicit val FooDecoder: HeaderDecoder[Foo] =
HeaderDecoder
.decoder(
"Mandatory1",
"Mandatory2",
"Optional1"
)(Foo.apply)
}
When Optional1 is missing from the csv header and there is no data respectively for that field, I'm getting "Missing header for Optional1". How can I prevent this error and handle it properly?
I think, at the moment, you're kind of stuck. Those are two different formats, as far as kantan.csv is concerned. You can have optional data, but not optional headers.
@nrinaudo Hi, we are considering using this lib at work and this would be a very useful feature, especially for historical data reprocessing any plan on implementing it ?