Re: [R] Using read.xls

From: Marc Schwartz <marc_schwartz_at_me.com>
Date: Thu, 26 May 2011 10:09:06 -0500

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/xls2csv.pl" "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.

HTH, Marc Schwartz



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 26 May 2011 - 15:16:35 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 - 15:50:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive