No commit activity in last 3 years
No release in over 3 years
If you want to convert .xls to .csv simply and unwittingly, then this gem is for you!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6.4

Runtime

>= 2.6.0
 Project Readme

Ruby on Rails Paperclip xls to csv Processor

This gem is Paperclip processor, that uses xls2csv to convert .xls to .csv.

Requirements

Installation

gem 'xls_to_csv-paperclip-processor'

xls2csv Instalation

Install xls2csv using your favorite package manager. On OS X, the easiest way to do it is by using Homebrew.

sudo brew install catdoc

Various linux distributions should use similar methods with their respected package managers.

Using Processor

Use it as you would any other Paperclip processor. In your model:

class SomeCsvAttachement < ActiveRecord::Base
  has_attached_file :data,
                    :styles => {
                      :converted => {                       
                         :format => "csv",
                         :params => "-c, -q 3"
                      }
                    },
                    :path => ":rails_root/data/some_csv_attachements/:id_partition/:basename.:extension",
                    :processors => [:xls_to_csv]

  validates_attachment_content_type :data, :content_type => ['text/csv','text/comma-separated-values','text/csv','application/csv','application/excel','application/vnd.ms-excel','application/vnd.msexcel','text/anytext','text/plain']    
end

which will convert your .xls document into .csv, and keep both files (.xls and .csv) on the server. If your attachment is not a .xls it will just copy it.