# Read MS Excel Files from Rails App?

**URL:** <https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303>\
**Category:** Rails\
**Created:** [September 28, 2006, 1:46am UTC](https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303 "2006-09-28T01:46:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathandelane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@nathandelane](https://www.ruby-forum.com/u/nathandelane)\
**Post date:** [September 28, 2006, 1:46am UTC](https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303/1 "2006-09-28T01:46:27Z")

</div>

Does anyone have experience or even any ideas of how to read large  
(80,000+ rows and approx. 14MB) MS Excel files into a Rails app? I have  
successfully used CSV to read large amounts of data, but can’t seem to  
find a way to use the Excel format. I have looked into the Ruby  
spreadsheet gem, but according to the documentation it is only for  
producing Excel files.

Any help would be appreciated.

Thanks,  
Nathan

---

<div class="post-metadata">

**Author:** ![nathandelane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@nathandelane](https://www.ruby-forum.com/u/nathandelane)\
**Post date:** [September 28, 2006, 3:24am UTC](https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303/2 "2006-09-28T03:24:32Z")

</div>

Nathan L. wrote:

> Does anyone have experience or even any ideas of how to read large  
> (80,000+ rows and approx. 14MB) MS Excel files into a Rails app? I have  
> successfully used CSV to read large amounts of data, but can’t seem to  
> find a way to use the Excel format. I have looked into the Ruby  
> spreadsheet gem, but according to the documentation it is only for  
> producing Excel files.

There is a nice perl module on CPAN for reading Excel files. Win32  
environment is NOT required. Obviously it is not Ruby but maybe you can  
get Perl to handle one small aspect of processing the Excel file then  
let Ruby take it from there.

Eric

---

<div class="post-metadata">

**Author:** ![nathandelane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@nathandelane](https://www.ruby-forum.com/u/nathandelane)\
**Post date:** [September 28, 2006, 4:10am UTC](https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303/3 "2006-09-28T04:10:35Z")

</div>

you can get excel to save the file in CSV format and then import it.  
This might work fine unless you need to do it repeatedly.

---

<div class="post-metadata">

**Author:** ![nathandelane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@nathandelane](https://www.ruby-forum.com/u/nathandelane)\
**Post date:** [September 28, 2006, 4:22am UTC](https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303/4 "2006-09-28T04:22:37Z")

</div>

> > Nathan
> 
> Hi Nathan,  
> I would suggest using the parseexcel library. If you have the Ruby  
> Cookbook it is described in there

That might work… I’ve tried that on relatively simple excel documents  
(first column = names, 4 optional columns with integer values) and while  
it worked for me, it didn’t for others. It was character set issues  
that  
seemed to come from the machine the excel document was generated on.

Anyway, maybe you won’t have that problem, maybe you will. We ended up  
making our staff convert to CSV first.

---

<div class="post-metadata">

**Author:** ![nathandelane](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/df705f/32.png) [@nathandelane](https://www.ruby-forum.com/u/nathandelane)\
**Post date:** [September 28, 2006, 4:10am UTC](https://www.ruby-forum.com/t/read-ms-excel-files-from-rails-app/70303/5 "2006-09-28T04:10:36Z")

</div>

> Does anyone have experience or even any ideas of how to read large (80,000+ rows and approx. 14MB) MS Excel files into a Rails app? I have successfully used CSV to read large amounts of data, but can’t seem to find a way to use the Excel format. I have looked into the Ruby spreadsheet gem, but according to the documentation it is only for producing Excel files.
> 
> Any help would be appreciated.
> 
> Thanks,  
> Nathan

## Hi Nathan, I would suggest using the parseexcel library. If you have the Ruby Cookbook it is described in there

Chris
