All Projects → madeintandem → Row_boat

madeintandem / Row_boat

Licence: mit
Import CSVs into your ActiveRecord models

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Row boat

Spreadsheet architect
Spreadsheet Architect is a library that allows you to create XLSX, ODS, or CSV spreadsheets super easily from ActiveRecord relations, plain Ruby objects, or tabular data.
Stars: ✭ 1,160 (+9566.67%)
Mutual labels:  csv, activerecord
Import
This is a library that provides generic functionalities for the implementation of imports. In addition to maximum performance and optimized memory consumption, Pacemaker can also be used to implement imports in distributed scenarios that place the highest demands on speed and stability.
Stars: ✭ 125 (+941.67%)
Mutual labels:  csv, import
Magento2 Import Export Sample Files
Default Magento 2 CE import / export CSV files & sample files for Firebear Improved Import / Export extension
Stars: ✭ 68 (+466.67%)
Mutual labels:  csv, import
Couchimport
CouchDB import tool to allow data to be bulk inserted
Stars: ✭ 125 (+941.67%)
Mutual labels:  csv, import
Portphp
Data import/export framework for PHP
Stars: ✭ 225 (+1775%)
Mutual labels:  csv, import
Csvkeychain
Import/export between Apple Keychain.app and plain CSV file.
Stars: ✭ 281 (+2241.67%)
Mutual labels:  csv, import
Csvpack
csvpack library / gem - tools 'n' scripts for working with tabular data packages using comma-separated values (CSV) datafiles in text with meta info (that is, schema, datatypes, ..) in datapackage.json; download, read into and query CSV datafiles with your SQL database (e.g. SQLite, PostgreSQL, ...) of choice and much more
Stars: ✭ 71 (+491.67%)
Mutual labels:  csv, activerecord
Active admin import
📎 active_admin_import is based on activerecord-import gem - the most efficient way to import for ActiveAdmin
Stars: ✭ 155 (+1191.67%)
Mutual labels:  csv, import
Csvreader
csvreader library / gem - read tabular data in the comma-separated values (csv) format the right way (uses best practices out-of-the-box with zero-configuration)
Stars: ✭ 169 (+1308.33%)
Mutual labels:  csv, import
import-cli-simple
This the meta package for Pacemaker Community, a Symfony based CLI application that provides import functionality for products, categories, attributes, and attribute-sets. The default format is CSV, adapters for XML are also available. The application can be declaratively extended by additional operations, which can be used to reassemble and exe…
Stars: ✭ 69 (+475%)
Mutual labels:  csv, import
Simple Excel
Read and write simple Excel and CSV files
Stars: ✭ 502 (+4083.33%)
Mutual labels:  csv, import
Filehelpers
The FileHelpers are a free and easy to use .NET library to read/write data from fixed length or delimited records in files, strings or streams
Stars: ✭ 917 (+7541.67%)
Mutual labels:  csv
Active Record Query Trace
Rails plugin that logs/displays a backtrace of all SQL queries executed by Active Record
Stars: ✭ 785 (+6441.67%)
Mutual labels:  activerecord
Tableexport
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Stars: ✭ 781 (+6408.33%)
Mutual labels:  csv
Node Csv Parse
CSV parsing implementing the Node.js `stream.Transform` API
Stars: ✭ 768 (+6300%)
Mutual labels:  csv
Type scopes
Automatic scopes for ActiveRecord models.
Stars: ✭ 24 (+100%)
Mutual labels:  activerecord
Spreplicator
♻ Replicates SharePoint Lists
Stars: ✭ 22 (+83.33%)
Mutual labels:  csv
Tslib
Runtime library for TypeScript helpers.
Stars: ✭ 762 (+6250%)
Mutual labels:  import
Javalite
JavaLite is a cohesive collection of frameworks designed from ground up to add pleasure back to your daily life
Stars: ✭ 753 (+6175%)
Mutual labels:  activerecord
Activerecord Postgis Adapter
ActiveRecord connection adapter for PostGIS, based on postgresql and rgeo
Stars: ✭ 746 (+6116.67%)
Mutual labels:  activerecord

RowBoat

Created by     DevMynd Logo

Gem Version    Build Status

A simple gem to help you import CSVs into your ActiveRecord models.

Check out the documentation!

It uses SmarterCSV and activerecord-import to import database records from your CSVs.

Contents

Installation

Add this line to your application's Gemfile:

gem "row_boat", "~> 0.4"

And then execute:

$ bundle

Basic Usage

Full documentation can be found here.

Below we're defining the required methods (import_into and column_mapping) and a few additional options as well (via value_converters and options). Checkout API.md for the full documentation for more details :)

class ImportProduct < RowBoat::Base
  # required
  def import_into
    Product # The ActiveRecord class we want to import records into.
  end

  # required
  def column_mapping
    {
      # `:prdct_name` is the downcased and symbolized version
      # of our column header, while `:name` is the attribute
      # of our model we want to receive `:prdct_name`'s value
      prdct_name: :name,
      dllr_amnt: :price_in_cents,
      desc: :description
    }
  end

  # optional
  def value_converters
    {
      # Allows us to change values we want to import
      # before we import them
      price_in_cents: -> (value) { value * 1000 }
    }
  end

  # optional
  def preprocess_row(row)
    if row[:name] && row[:description] && row[:price]
      row
    else
      nil # return nil to skip a row
    end
    # we could also remove some attributes or do any
    # other kind of work we want with the given row.
  end

  #optional
  def options
    {
      # These are additional configurations that
      # are generally passed through to SmarterCSV
      # and activerecord-import
      validate: false, # this defaults to `true`
      wrap_in_transaction: false # this defaults to `true`
    }
  end
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests (run appraisal install and appraisal rake to run the tests against different combinations of dependencies). You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/devmynd/row_boat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].