Questions tagged [spreadsheet-gem]

The spreadsheet gem is a Ruby library for reading and writing Microsoft Excel files.

Project page on Rubyforge

10 questions
9
votes
1 answer

Use custom colors with Spreadsheet gem

I need to use custom color and pattern_fg_color (HEX: 0x00adb1, RGB: 0,173,177). I was following advice from here, but it didn't work out for me (I am using it in another library based on the Spreadsheet…
potashin
  • 44,205
  • 11
  • 83
  • 107
5
votes
2 answers

How to close files in the ruby gem "Spreadsheet?"

The code below works as it should the FIRST time I run it: require 'rubygems' require 'spreadsheet' book = Spreadsheet.open '/Users/me/myruby/Mywks.xls' sheet = book.worksheet 0 row = sheet.row(1) puts row[1] book.write…
Roy
  • 57
  • 1
  • 6
3
votes
3 answers

Spreadsheet Gem unbearably slow on Ruby 1.9.2

I'm building an Excel parser for my data team, and I've run into something of an issue with the Spreadsheet 0.6.5.1 gem. In Ruby 1.9.2, use of the Spreadsheet.open method immediately hops up to 700m-1.3g of memory, and hangs indefinitely there, even…
ironchamber
  • 204
  • 1
  • 10
3
votes
2 answers

Access a cell by name using the `spreadsheet` gem

If I have a sheet variable that is of type Spreadsheet::Excel::Worksheet, right now we access B2 by doing: MY_CUSTOM_CELL = [1, 1] sheet[*MY_CUSTOM_CELL] # => Contents of B2 In LibreOffice (And I'm sure Excel), I can assign a name for that cell in…
ardavis
  • 9,842
  • 12
  • 58
  • 112
3
votes
1 answer

Export Excel (xls or xlsx or CSV) sheet with validation/ rule applied on column

I want to export a template Excel sheet, so that user can fill it and can upload with their data. In exported sheet, I want to put some validation or rule on column values. So that, user only can fill the value as per rules applied which can be only…
Kamesh
  • 471
  • 1
  • 4
  • 19
2
votes
1 answer

Ruby spreadshet gem, how can I center align a number

I'm using http://spreadsheet.rubyforge.org to generate a spreadsheet and I'm having trouble with something. I'm opening an existing workbook and adding data to it. I have manged to get number formatting working to some extent, at least excel is…
tsdbrown
  • 5,038
  • 3
  • 36
  • 40
1
vote
1 answer

Spreadsheet::Workbook.new creates .xls instead of xlsx

I want to generate xlsx file but Spreadsheet genrates xls How to generate the xlsx file using the same gem ?
0
votes
1 answer

Ruby Spreadsheet gem format cell stops working on third sheet

I am trying to set the background-color for a table. it works well with this code. But if my workbook has more then 3 sheets, the set_format will not work on third sheet row(8) 4th cell. All formatting will not work from there on. every xls file…
noobs
  • 3
  • 1
0
votes
1 answer

Split individual sheets in a spreadsheet xls file to csv files

I have a daily-downloaded (using mechanize & whenever/sidekiq+redis) .xls file with two worksheets and want to split them into two files, with each having one sheet. I've tried many ways to no avail (tossed in a random delete method hoping that…
JHFirestarter
  • 63
  • 1
  • 9
0
votes
2 answers

How to add data from array of array into cell using Ruby Spreadsheet gem

I have an array of arrays like: arr_all = [arr_1, arr_2, arr_3, arr_r] where: arr_1 = [2015-08-19 17:30:24 -0700, 2015-08-19 17:30:34 -0700, 2015-08-19 17:30:55 -0700] arr_2 = ... arr_3 = ... I have a file to modify. I know how to add an array as…
napsterdsilva
  • 163
  • 1
  • 2
  • 14