CsvFormatGuesser
Guess format and encoding of .csv/.tsv files to generate options compatible with ruby CSV class.
Installation
Add this line to your application's Gemfile:
gem 'csv-format-guesser'
And then execute:
$ bundle
Or install it yourself as:
$ gem install csv-format-guesser
Usage
require 'csv'
require 'csv_format_guesser'
path = 'sample.csv'
opts = CsvFormatGuesser.new(path).csv_opts
CSV.open(path, opts).each do |line|
puts line
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request