Built on top of the roo gem for easy abstraction of spreadsheet types supported by roo as tabular data input. Assumes the first row to be headings with keys and forms clean Ruby hashmaps for all consecutive rows using cells as values for respective keys.
Originally it was a fork of batch_factory repo. Rewritten almost from scratch. The main reason is to provide faster and predictable release cycles.
Add this line to your Gemfile
gem 'roo-hasherize'
or
gem install roo-hasherize
hash = Roo::Hasherize.call(target, options)
options are:
keys
- Use it only if your dataset doesn't contain headerssheet
- Number of sheet to hasherize (only makes sense for spreadsheets)extension
- To explicityly specify file format
Spreadsheet type is detected by the file extension (xls
, xlsx
, ods
),
files without extension considered csv
.
Also, this can be specified explicitly with the extension
option:
All other (roo specific) options are passed as is down to a corresponding file type handler class,
e.g. csv_options
is passed to Roo::CSV
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
- Fork it ( https://github.com/[my-github-username]/xftp/fork )
- 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 a new Pull Request