Skip to content

Commit

Permalink
added roo-xls
Browse files Browse the repository at this point in the history
  • Loading branch information
Gonzalo Moreno committed Jul 27, 2016
1 parent e45c9cc commit 1693ea9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/spree/importer_core/base_importer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'roo'
require 'roo-xls'

module Spree
module ImporterCore
Expand Down Expand Up @@ -80,6 +81,10 @@ def self.sample_file
def open_spreadsheet
@spreadsheet = Roo::Spreadsheet.open(@filepath, extension: :xlsx)
@spreadsheet.default_sheet = @spreadsheet.sheets.first
rescue Zip::Error
# Supports spreadsheets with extension .xls
@spreadsheet = Roo::Spreadsheet.open(@filepath)
@spreadsheet.default_sheet = @spreadsheet.sheets.first
rescue => e
add_error message: e.message, backtrace: e.backtrace, row_index: nil, data: {}
end
Expand Down
3 changes: 2 additions & 1 deletion spree_importer_core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_development_dependency 'factory_girl', '~> 4.4'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails', '~> 2.13'
s.add_development_dependency 'sass-rails', '~> 4.0.2'
s.add_development_dependency 'sass-rails', '~> 5.0.0.beta1'
s.add_development_dependency 'selenium-webdriver'
s.add_development_dependency 'simplecov'
s.add_development_dependency 'sqlite3'
Expand All @@ -37,4 +37,5 @@ Gem::Specification.new do |s|

# Roo provides an interface to Open Office, Excel, and Google Spreadsheets
s.add_dependency 'roo'
s.add_dependency 'roo-xls'
end

0 comments on commit 1693ea9

Please sign in to comment.