Best way to approach reading and parsing a large XLSX file?

Hello, I’m developing an app that basically, receives a 10MB or less
files with +30000 rows or so, and another XLSX file with about 200rows,
have to read one row of the smallest file, look it up on the largest
and write data from both files to a new one.

I just did a test reading all the rows from the largest file using ROO
(Spreadsheet doesn’t support XSLX and Creek look good but I can’t find a
way to read row by row) and write it to a XLS file (no comparisons or
anything) and it basically made my computer crash, the server crashed, I
tried rebooting it and it said It was already started, anyway, it was a

So, my question was, is there gem that works best with large XLSX files
is there another way to approach this withouth crashing my computer?

This is what I had (It’s very possible I’m doing it wrong, help is
What i was trying to do here, was to process the files and create the
XLS file after both of the XLSX files were uploaded:

require ‘roo’
require ‘spreadsheet’
class UploadFiles < ActiveRecord::Base
after_commit :process_files
attr_accessible :inventory, :material_list
has_one :inventory
has_one :material_list
has_attached_file :inventory, :url=>"/:current_user/inventory",
has_attached_file :material_list,
validates_attachment_presence :material_list
accepts_nested_attributes_for :material_list, :allow_destroy => true
accepts_nested_attributes_for :inventory, :allow_destroy => true
validates_attachment_content_type :inventory, :content_type =>
:message => “Only .XSLX files are accepted as Inventory”
validates_attachment_content_type :material_list, :content_type =>
:message => “Only .XSLX files are accepted as Material List”

def process_files
inventory = +
material_list = +
inventory.default_sheet = inventory.sheets.first
scl =
sheet1 = scl.create_worksheet
sheet1.row(1).concat %w{ProjectCode ProjectName ContractNo Item Qty
2.upto(5) do |line|
@projectCode = inventory.cell(line,‘B’)
@ProjectName = inventory.cell(line,‘C’)
@ContractNo = inventory.cell(line,‘D’)
@Item = inventory.cell(line,‘N’)
@AviQty = inventory.cell(line,‘Q’)
@ItemDescription = inventory.cell(line,‘AA’)
sheet1.row(line).push(@projectCode, @ProjectName, @ContractNo,
@AviQty, @ItemDescription)
scl.write(Rails.root.to_s +

And it works, but only for small files. If i upload the real files and
the test ones, the browser stays “Waiting for localhost” the server
doesn’t show any errors, and the output file doesn’t seem to save at
The output is never created.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs