Read MS Excel Files from Rails App?

Read MS Excel Files from Rails App?
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

Nathan Leach 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

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.

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

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

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.