I'm trying to parse a simple tab-delimited file with Smarter CSV, but regardless of what I try, when parsed, all the headers get merged into giant headers. Here is an example file:
Date Total Time
2017-09-06 1.1
The output will always look like this:
[{:date_total_time=>"2017-09-06\t1.1"}]
This is how I'm opening my file:
File.open(file, "r:bom|utf-8", col_sep: :auto, row_sep: :auto, auto_row_sep_chars: 500, force_simple_split: true, strip_chars_from_headers: /[\-"]/) do |f|
chunk = SmarterCSV.process(f)
puts chunk
end
I've already tried specifically assigning the to tab like this: col_sep: "\t"
In the documentation it says:
any of the keys in the header line will be downcased, spaces replaced by underscore, and converted to Ruby symbols before being used as keys in the returned Hashes
which seems to be my problem, but I can't find a way around it. The rest of the file parses as expected, as you can see in the output.