Re: [R] Using read.xls

From: Marc Schwartz <>
Date: Thu, 26 May 2011 10:52:43 -0500

On May 26, 2011, at 10:16 AM, Gabor Grothendieck wrote:

> On Thu, May 26, 2011 at 11:09 AM, Marc Schwartz <> wrote:
>> On May 26, 2011, at 5:09 AM, vioravis wrote:

>>> I am using read.xls command from the gdata package. I get the following error
>>> when I try to read a work sheet from an excel sheet.
>>> Error in xls2sep(xls, sheet, verbose = verbose, ..., method = method, :
>>> Intermediate file 'C:\Tmp\RtmpYvLnAu\file7f06650f.csv' missing!
>>> In addition: Warning message:
>>> running command '"C:\Apps\Perl\bin\perl.exe" "C:/Program
>>> Files/R/R-2.13.0/library/gdata/perl/" "excelFileName.xls"
>>> "C:\Tmp\RtmpYvLnAu\file7f06650f.csv" "Test Sheet"' had status 5
>>> Error in file.exists(tfn) : invalid 'file' argument

>>> However, the same command works fine with another excel file stored in the
>>> same directory.
>>> Could you please let me know what is causing this problem??
>>> Thank you.
>> It looks like the intermediate CSV file is not being created. read.xls() works by extracting the data from the Excel file worksheet, using a Perl script to dump it to a CSV file and then using read.csv() to get the data into R. It is essentially a reversal of the process that I use in WriteXLS() in the CRAN package of the same name.
>> For some reason, that intermediate CSV file is not being created, possibly because the worksheet you are referencing does not exist, is corrupted or there is some other conflict. Presumably, it is not a permissions issue, if you can use read.xls() on a different XLS file.
>> Check the XLS file that you are attempting to use and be sure that you can open it properly and that you are passing the correct worksheet identifier.  Also, as I am thinking about it, I believe that read.xls() is not set up to handle XLSX files, so be sure that this is not the case. If so, you will need to re-save the file to an XLS format file.
> read.xls in gdata does handle both xls and xlsx files in the current
> CRAN version.

Thanks for the clarification Gabor. Upon further review, it appears that one might have to run installXLSXsupport() in the gdata package in order to support that capability, if the user's Perl installation does not already provide that support by default.

The gdata helper function xlsFormats() can be used to test that.

This issue may or may not be germane to the OP.


Marc mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 26 May 2011 - 15:54:24 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 26 May 2011 - 16:30:10 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive