Questions tagged [roo-gem]

Roo is a ruby gem which provides an interface to Open Office, Excel, and Google Spreadsheets.

Roo is a ruby gem which provides an interface to Open Office, Excel, and Google Spreadsheets.

For more information see the gem documentation page and the github project page

69 questions
1
vote
2 answers

no implicit conversion of Symbol into Integer using Roo gem / XLS, XLSX, CSV File imports

I am using Roo Gem in rails 5 to handle my data imports. My CSV import is working fine, but I think its more efficient to use XLS and XLSLX as the end user would be better equipped to use these and I can provide a styled import template for them to…
Shawn Wilson
  • 1,311
  • 14
  • 40
1
vote
0 answers

NameError: uninitialized constant Roo::Excelx::Zip

I am using ruby 2.2.1 and rails 4.2.1. I am using following gems. roo (2.0.1) roo-xls (1.0.0) rubyzip (1.1.7) I have written a rake task as follows. check_roo.rake require 'rubygems' require 'roo-xls' require 'roo' desc "desc" task :check_roo =>…
abhima9yu
  • 143
  • 1
  • 8
1
vote
0 answers

How can I cut down on the size of file loaded into Roo object in Rails?

I am using the roo gem to parse data in a CSV. The CSV is around 400MB in size however, and when I attempt to parse it with this loop... (2..sheet.last_row).collect do |i| # parsing code... end It will error out with [FATAL] failed to allocate…
daveomcd
  • 6,367
  • 14
  • 83
  • 137
1
vote
2 answers

Rails Rename tempfile

I am using roo-rb for accessing the uploaded files. My code is like this: s = Roo::Excelx.new(params[:upload][:file].tempfile.path) But I am having problem with it because the generated tempfile has no extension and I'm having this…
John Isaiah Carmona
  • 5,260
  • 10
  • 45
  • 79
1
vote
1 answer

Roo getting number instead of text

I am using roo to parse out an excel sheet like this worksheet.parse( :partNo => "PM_PartNo", :salePartNo => "PM_SalesPartNo", :appSearchInclude => "PM_AppSearchInclude", :desc => "PM_WebApp_Description", …
steventnorris
  • 5,656
  • 23
  • 93
  • 174
1
vote
1 answer

detect encoding of xlsx content in ruby

I have an app which allows uploading spreadsheets in xls, xlsx and csv format. The data is later used at various client facing places. The people managing the data use various tools to create the spreadsheets, including mac/excel, win/excel,…
schangli
  • 171
  • 7
1
vote
4 answers

Rails Csv.new where is this class being called from?

I'm creating my own version of Rayan Bates CSV screencast here... http://railscasts.com/episodes/396-importing-csv-and-excel I have this in my model... def self.open_spreadsheet(file) case File.extname(file.original_filename) when ".csv"…
Mark Locklear
  • 5,044
  • 1
  • 51
  • 81
0
votes
2 answers

Fastest way to read the first row of big XLSX file in Ruby

I need to be able to read the first (header) row in big xlsx file (350k x 12 cells, ~30MB) very fast in Ruby on Rails app. I am using Roo gem at the moment, which is fine for smaller files. But for files this big it takes 3-4 minutes. Is there a way…
GTO
  • 127
  • 11
0
votes
2 answers

Ruby on Rails - Roo gem | Issue opening active record attachment

Status: I have a simple new Ruby On Rails App I need to import some data from MS Excel in .xlsx format I programmed an uploading to ActiveRecord as attachment via an attribute called 'excel' I found a gem called Roo which should do the opening of…
Julian
  • 27
  • 6
0
votes
1 answer

How to avoid importing nil object when reading spreadsheet with roo on Rails 5.2?

My application manages hierarchical classifications based on lists of values (dictionnaries). At some point, I need to import the parent-child relationships from an Excel sheet, and create persisted ValuesToValues objects. Based on Ryan Bates'…
user1185081
  • 1,898
  • 2
  • 21
  • 46
0
votes
0 answers

Reject items not in association table instead of creating new records when importing CSV using Roo gem

I am using roo-gem to import the following spreadsheet of authors designed as below: I have tables in the database called authors, states, publishers and genres which the data in the respective excel columns map to. As you can see, the first row…
adamvanbart
  • 67
  • 1
  • 10
0
votes
0 answers

How to add temporary attributes to Ruby on Rails model during importation

I use the roo gem to import data from xlsx files. But in some cases, column available in the xlsx file will not match the target model. Some columns need concatenation or look-up ... there are more columns in the file than in the target model. Here…
user1185081
  • 1,898
  • 2
  • 21
  • 46
0
votes
4 answers

Open a remote file with Roo gem uploaded using Active Storage on Heroku and Amazon S3

I am using the ROO gem to parse an Excel file uploaded by the user (Active Storage with AWS S3) on Heroku. Since I am on Heroku I cannot download it on filesystem and then parse it. How can I open it from HTTP? Model class Report <…
sparkle
  • 7,530
  • 22
  • 69
  • 131
0
votes
1 answer

Rails Import: "No Implicit conversion of string into array"

I'm attempting to import values from a spreadsheet into a table. I am adding new records for each row to an array, and then importing that array. My Code is below: def import(path) spreadsheet = Roo::Spreadsheet.open(path+"Data.xlsx") sales =…
neanderslob
  • 2,633
  • 6
  • 40
  • 82
0
votes
0 answers

How to write ALL text content from div element to csv? Ruby, csv, chromedriver, watir

I am writing text content from a div element to a csv file using the ruby csv gem. When I output this div's text content to the console, I get all the text content including that from child divs. When I write to the csv file, it only outputs the…
djangodev
  • 363
  • 5
  • 15