[R] Import xlsx file in Ubuntu 9.04

Marc Schwartz marc_schwartz at me.com
Wed Jul 8 15:57:47 CEST 2009


On Jul 8, 2009, at 6:56 AM, Rodrigo Aluizio wrote:

> Hi list,
> By the entire last 2 weeks I was looking for a way to directly  
> import xlsx
> files to R in a Linux OS (Ubuntu 9.04). I already read the R Import/ 
> Export
> guide, and I know how to use gdata to import xls files and  
> read.table to
> import .csv. My problem is that all data that I receive is in the xlsx
> format, and I have to convert all the files to xls.
> Well, when I was using Windows Vista OS, RODBC did the trick with the
> odbcConnectExcel2007 function (which I know is not present in the  
> Linux
> RODBC package, probably due to drivers issue). Isn't there a way to  
> import
> this xlsx files directly to R without any previous conversion (.csv or
> .xls)?
>
> Thank you for the attention, it's probable that some one already  
> asked it. I
> even remember seen that somewhere, but without a definitive answer.
>
> Rodrigo.



Your best bet on Linux would be to open the Excel 2007 files using  
OpenOffice's Calc and save them to CSV files. The latest versions of  
OpenOffice will open Office 2007 files.

An alternative of course would be to see if it is reasonable for the  
providers of the files to save them in the older XLS format instead,  
or to see if they have other file formats that they can send you  
rather than using Excel at all.

There is a very preliminary Perl module in progress, that should  
eventually provide for a more efficient path:

   http://search.cpan.org/dist/Spreadsheet-XLSX/

But from what I have seen, there are enough problems with it  
(including data integrity issues), that I would not use it in  
production work.

Unfortunately, I don't believe that you have a lot of options on Linux  
at the moment.

HTH,

Marc Schwartz




More information about the R-help mailing list