GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - continuum/active_importer: Define importers that load tabular data from spreadsheets or CSV files into any ActiveRecord-like ORM.

This repository was archived by the owner on Nov 23, 2021. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

95 Commits
95 Commits

Folders and files

NameName
Last commit message
Last commit date
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
.rspec
.rspec
 
 
Gemfile
Gemfile
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
Rakefile
Rakefile
 
 
active_importer.gemspec
active_importer.gemspec
 
 

Repository files navigation

ActiveImporter

![Gitter](https://badges.gitter.im/Join Chat.svg)

ARCHIVED

Define importers that load tabular data from spreadsheets or CSV files into any ActiveRecord-like ORM.

Installation

Add this line to your application's Gemfile:

gem 'active_importer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install active_importer

Usage

Define classes that you instruct on how to import data into data models.

class EmployeeImporter < ActiveImporter::Base
  imports Employee

  column 'First name', :first_name
  column 'Last name', :last_name
  column 'Department', :department do |department_name|
    Department.find_by(name: department_name)
  end
end

The importer defines what data model it imports data into, and how columns in the data source map to fields in the model. Also, by providing a block, the source value can be processed before being stored, as shown with the 'Department' column in the example above.

Once defined, importers can be invoked to import a given data file.

EmployeeImporter.import('/path/to/file.xls')

The data file is expected to contain columns with titles corresponding to the columns declared. Any extra columns are ignored. Any errors while processing the data file does not interrupt the whole process. Instead, errors are notified via some callbacks defined in the importer (see below).

Documentation

For mote detailed information about the different aspects of importing data with active_importer, refer to the following sections in the wiki.

Getting started

  • Understanding how spreadsheets are parsed
  • Mapping columns to attributes

Diving in

  • Custom data processing
  • Helper methods
  • File extension and supported formats
  • Passing custom parameters
  • Events and callbacks
  • Selecting the model instance to import into (Update instead of create)
  • Error handling
  • Selecting the sheet to get data from
  • Skipping rows

Advanced features

  • Aborting the import process
  • Transactional importers

Contributing

Contributions are welcome! Take a look at our contributions guide for details.

About

Define importers that load tabular data from spreadsheets or CSV files into any ActiveRecord-like ORM.

continuum.github.io/active_importer/

Topics

activerecordcsv-filesdata-importimporterormrubyspreadsheettabular-data

Resources

Readme
MIT license
Activity
Custom properties

Stars

327 stars

Watchers

5 watching

Forks

19 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.