continuum / active_importer

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

Home Page:http://continuum.github.io/active_importer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to have multiple names for each column

khelal opened this issue · comments

Hi, is it possible to have different variations of a name for each column?
Something like:

    column ['unit', 'units', 'u'], :unit
    column ['note', 'notes', 'n'], :note, optional: true

Interesting suggestion. Let me give it a thought about the implementation and the possible consequences.

At first, it comes to mind the fact that the column names need to be unique. It cannot happen something like:

column %w(unit units), :unit
column %w(units), :units

Also, we have to consider the possibility that, in an example like yours (column ['unit', 'units'], :unit), what if the spreadsheet file comes with a column header 'unit' and another column with header 'units'?

As a side note, this suggestion also relates to a feature I've been thinking about, that the column names should be matched disregarding case, so a column named 'first name' would match a spreadsheet column with a header like 'First Name'.

@khelal I'm working on a fairly large rewrite of the gem, that includes this possibility. Stay tuned.