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
17
votes
4 answers

How do I convert a date into a time when parsing an .xls doc using Rails?

I'm using Rails 5. I want to parse an .xls (not to be confused with .xlsx doc) using the code below book = Roo::Spreadsheet.open(file_location) sheet = book.sheet(0) text = sheet.to_csv csv = CSV.parse(text) arr_of_arrs = csv …
Dave
  • 15,639
  • 133
  • 442
  • 830
16
votes
4 answers

Trim a trailing .0

I have an Excel column containing part numbers. Here is a sample As you can see, it can be many different datatypes: Float, Int, and String. I am using roo gem to read the file. The problem is that roo interprets integer cells as Float, adding a…
Dan Garman
  • 646
  • 1
  • 5
  • 20
7
votes
4 answers

How do I parse an Excel file that will give me data exactly as it appears visually?

I'm on Rails 5 (Ruby 2.4). I want to read an .xls doc and I would like to get the data into CSV format, just as it appears in the Excel file. Someone recommended I use Roo, and so I have book = Roo::Spreadsheet.open(file_location) sheet =…
Dave
  • 15,639
  • 133
  • 442
  • 830
6
votes
2 answers

"OLE2 signature is invalid" when trying to parse XLS file

I'm trying to upload and parse an .XLS file. I've tried with roo-xls and Spreadsheet, but with both, I'm getting this error: Ole::Storage::FormatError in UploadController#upload OLE2 signature is invalid I found a few resources about this error,…
Joe Morano
  • 1,715
  • 10
  • 50
  • 114
5
votes
2 answers

Creating xlsx file using roo gem

I was using spreadsheet gem for reading and writing data to xls file. It was kind of easy. Now I need to work on xlsx file and I guess spreadsheet doesn't support xlsx files. I found roo gem supports xlsx. For creating of xls file using…
themaster
  • 453
  • 11
  • 32
5
votes
2 answers

Getting uninitialized constant Student::Roo error while importing csv file in rails

I have an application on which I want to provide the feature to import the records from CSV and Excel file formats. I am using roo gem for it, but at the time of importing it gives the error "uninitialized constant Student::Roo". Here is the code…
Nitesh Mishra
  • 570
  • 1
  • 4
  • 18
4
votes
1 answer

ArgumentError (string contains null byte) when uploading file in rails

I am trying to use the roo gem to run some operations on an excel File. This works perfectly when I do it manually: file = File.join(Rails.root, 'october_data.xlsx') spreadsheet = Roo::Excelx.new(file) However, this does not work when I upload the…
Philip7899
  • 4,599
  • 4
  • 55
  • 114
4
votes
1 answer

Formatting Excel cell from number to text in rails

I have made an application on which I have provide the feature to import the records from CSV and Excel file. I am using roo gem for it. The record added successfully but the problem is at the time of importing records from excel, it adds .0 to…
Nitesh Mishra
  • 570
  • 1
  • 4
  • 18
4
votes
2 answers

Import shared Google spreadsheet in Rails

I'm trying to import a shared (to everyone) Google spreadsheet into my database in Rails, using Roo. The following code: url = 'https://docs.google.com/spreadsheets/d/1-4kCLEXRcIlJB1wK5muZWsIL1nz5NsEWXyLrbe_HJNQ/edit?usp=sharing' xls =…
Serge
  • 163
  • 1
  • 10
3
votes
1 answer

Roo deprecated roo method

Using roo gem on Windows with the following code: require 'roo' require 'roo-xls' workbook = Roo::Excel.new 'test.xls' I get message to STDOUT [DEPRECATION] extend Roo::Tempdir and use its .make_tempdir instead The code works fine after that, I…
Leśny Rumcajs
  • 2,259
  • 2
  • 17
  • 33
3
votes
1 answer

Roo gem: cell background color

I'm using the Roo ruby gem to parse an xlsx file. Is there any way to get the background color of a cell? I've looked all around the code but couldn't find how to do it. Opening a spreadsheet using roo is very straightforward: spreadsheet =…
diegoesp
  • 113
  • 1
  • 10
3
votes
1 answer

How to raise error in a rails app?

I'm trying to upload a file using gem 'roo'. When I check for file of type, I have this in a instance method: def open_spreadsheet case File.extname(file.original_filename) when ".xls" then Roo::Excel.new(file.path, file_warning: :ignore) …
ivanacorovic
  • 2,669
  • 4
  • 30
  • 46
3
votes
1 answer

Roo with rails4 giving undefined method `[]' for nil:NilClass

I'm trying to import CSV and Excel files into a rails 4 project (with validation) using the Roo gem, based on http://railscasts.com/episodes/396-importing-csv-and-excel. I've made some changes to account for Rails4 instead of Rails3 and for changes…
digitig
  • 1,989
  • 3
  • 25
  • 45
2
votes
2 answers

Ruby Roo Gem - read Excel xlsx sheet into Hash

I'm stuck - I need to read Excel sheet into hash, I decided to go with the ROO gem, but I can't understand documentation. Please see below: I got excel spreadsheet: Fruits Qty Location apples 5 Kitchen pears 10 Bag plums 15 …
AKarpun
  • 321
  • 2
  • 6
  • 14
2
votes
0 answers

Roo spreadsheet parse exact header match

I have a spreadsheet(.xlsx) where two columns have the headers 'Auction Status' and 'Status'; When I run: rows = sheet.parse(auction_status: 'Auction Status', status: 'Status') both columns contain the values for the 'Auction Status' value. My guess…
wuliwong
  • 4,238
  • 9
  • 41
  • 69
1
2 3 4 5